-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Internal Client
-
None
-
Environment:Linux
-
ALL
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 ){
auto_ptr<DBClientCursor> files = _client.query( _filesNS , BSON( "filename" << fileName ) );
while (files->more())
}
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
Kazuki