Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Hanging query #558

Closed
wants to merge 1 commit into from

3 participants

@aheckmann

Fixes hanging queries when the primary in the replset goes down (relates to #537)

Fixed bug when ReplSetServers was called without new

Fixed a "string is not an Error" issue.

Some refactoring.

@christkv
Owner

not working :(. follow the instructions here

https://github.com/christkv/node-mongodb-native/issues/537

the node.js file is under

test/manual/replicaset_manual_kill_test.js

randomly start and stop servers and eventually it's not able to connect anymore for some reason

@christkv
Owner

confirmed current master works as expected for recovery

@christkv
Owner

bring down the primary first, then bring it back. then bring down a secondary and now it cannot reconnect.

@christkv
Owner

well at least on osx

@aheckmann
@christkv
Owner
@christkv
Owner
@aheckmann
@christkv
Owner
@jplock

I'm pretty sure we're running into #537 at work as well. Hopefully this can be merged soon. Thanks!

@aheckmann

closing. reopening a clean one.

@aheckmann aheckmann closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 30, 2012
  1. @aheckmann

    fix hanging query

    aheckmann authored
    relates to #537
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 14 deletions.
  1. +15 −14 lib/mongodb/db.js
View
29 lib/mongodb/db.js
@@ -1435,20 +1435,21 @@ var __retryCommandOnFailure = function(self, retryInMilliseconds, numberOfTimes,
// Get number of auths we need to execute
var numberOfAuths = _self.auths.length;
// Apply all auths
- for(var i = 0; i < _self.auths.length; i++) {
- _self.authenticate(_self.auths[i].username, _self.auths[i].password, function(err, authenticated) {
+ for(var i = 0; i < _self.auths.length; i++) {
+ _self.authenticate(_self.auths[i].username, _self.auths[i].password, function(err, authenticated) {
numberOfAuths = numberOfAuths - 1;
-
+
// If we have no more authentications to replay
- if(numberOfAuths == 0) {
+ if(numberOfAuths == 0) {
if(err != null || !authenticated) {
if(typeof _callback == 'function') _callback(err, null);
return;
} else {
// Execute command
- command(_self, _db_command, _options, function(err, result) {
- // Peform the command callback
- if(typeof _callback == 'function') _callback(err, result);
+ command(_self, _db_command, _options, _callback);
+
+ // Execute any backed up commands
+ process.nextTick(function() {
// Execute any backed up commands
while(_self.commands.length > 0) {
// Fetch the command
@@ -1464,13 +1465,13 @@ var __retryCommandOnFailure = function(self, retryInMilliseconds, numberOfTimes,
}
}
});
- }
+ }
} else if(err == null && _self.serverConfig.isConnected() == true) {
_self._state = 'connected';
// Execute command
- command(_self, _db_command, _options, function(err, result) {
- // Peform the command callback
- _callback(err, result);
+ command(_self, _db_command, _options, _callback);
+
+ process.nextTick(function() {
// Execute any backed up commands
while(_self.commands.length > 0) {
// Fetch the command
@@ -1482,16 +1483,16 @@ var __retryCommandOnFailure = function(self, retryInMilliseconds, numberOfTimes,
__executeInsertCommand(_self, command['db_command'], command['options'], command['callback']);
}
}
- });
+ });
} else {
_self._state = 'connecting';
// Force close the current connections
_self.serverConfig.close(function(err) {
// Retry the connect
setTimeout(function() {
- retryFunction(_self, _numberOfRetriesDone, _retryInMilliseconds, _numberOfTimes, _command, _db_command, _options, _callback);
+ retryFunction(_self, _numberOfRetriesDone, _retryInMilliseconds, _numberOfTimes, _command, _db_command, _options, _callback);
}, _retryInMilliseconds);
- });
+ });
}
});
};
Something went wrong with that request. Please try again.