[SERVER-1372] NULL check for auto_ptr<DBClientConnection> is missing Created: 07/Jul/10 Updated: 12/Jul/16 Resolved: 15/Jul/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kazuki Ohta | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux |
||
| Attachments: |
|
| Operating System: | ALL |
| Participants: |
| Description |
|
When I'm testing ReplicaPair for automatic failover, my C++ client program got SEGV. I setup two mongodb instances, and killed + restarted two servers randomly. I used PairedDbConnection, and call GridFS::removeFIle(). By the stacktrace, found that client.query() returns null auto_ptr if server is dead. But GridFS code doesn't check this situation. void GridFS::removeFile( const string& fileName ){ } I changed the code as follows, and confirmed that the problem was fixed. while (files.get() && files->more()) { .... }The attached patch added the null check for DBClientCursor in the client code. There are some places which have the same problem. The server program has the same problem in many places, but this patch is only for the client. Could you commit this patch, and please fix the server-side also? I'm really happy if this problem is backported to the stable version. Thanks in advance |
| Comments |
| Comment by Mathias Stearn [ 15/Jul/10 ] |
|
conn->more() will now assert if conn is NULL. Same for conn->hasResultFlag() |
| Comment by auto [ 15/Jul/10 ] |
|
Author: {'login': 'RedBeard0531', 'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}Message: Assert if DBClientCursor is NULL |
| Comment by Kazuki Ohta [ 07/Jul/10 ] |
|
previous patch wrongly includes the server-side codes. |
| Comment by Kazuki Ohta [ 07/Jul/10 ] |
|
Or returning empty DBClientCursor will be an another good solution. This doesn't need any modification outside DBClientCursor. |