-
Notifications
You must be signed in to change notification settings - Fork 2.5k
changeUser: Cannot call method 'scrambleBuff' of undefined #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Versions please. OS, database, node, ... |
Mac OSX 10.8.2, node v0.8.17, mysql 5.5.27 |
IIRC there is a bug, you can't call |
@clloyd can you show an example? Did you trigger |
I encountered same error message: (openSuse 12.2, node v0.8.18, mysql 5.5.30) myCode snippet: Thats my connection object, before i do connection.changeUser: { domain: null, Exception at function dbKeysAndCommentsStore.main: TypeError: Cannot call method 'scrambleBuff' of undefined |
I use now (openSuse 12.2, node v0.8.23, mysql 5.5.30) Exception at function sendOtherQueryAsUserAccountABC.main: Pseudo Code snippet: main:function()
{
try
{
var mysql = require('mysql');
var mysqlPool = mysql.createPool
({
host : 'myhost',
port : 'myport',
user : 'myusername',
password : 'mypassword'
});
// at file happens changeUser and query will be sent
var sendQuery1AsUserAccountXYZ = require('../../modules/sendQuery1AsUserAccountXYZ.js');
sendQuery1AsUserAccountXYZ.main(mysqlPool);
setTimeout(function()
{
// at file happens another changeUser and other query will be sent
var sendOtherQueryAsUserAccountABC = require('../../modules/sendOtherQueryAsUserAccountABC.js');
sendOtherQueryAsUserAccountABC.main(mysqlPool);
}, 1000);
}
catch(exception)
{
console.error('Exception at function main2:\n' + exception.stack);
process.exit(require('../../modules/error.js').EXIT_FAILURE);
}
finally
{
// done
}
} |
I too have this issue. node v0.8.16, mysql 5.5.24 The problem is fixed by changing line 109 of Protocol.js to the below: if (sequence.constructor == Sequences.ChangeUser) {
sequence.start(this._handshakeInitializationPacket);
} else {
sequence.start();
} This logic is already followed at lines 225/226 of the same file, where we specifically pass in the handshake initialization packet as an argument, required for ChangeUser.start() Thoughts? |
@carlholloway My test code: var mysql = require('mysql');
var mysqlPool = mysql.createPool({host : hoststring, port : portnumber,
user : guestUsername1, password : guestPassword1});
var i = 0;
setInterval(function()
{
if(i < 40)
{
mysqlPool.getConnection(function(err, connection)
{
console.log('db keepalive ' + i);
if(err)
{
console.log(err);
connection.end();
return false;
}
connection.query(queryString);
connection.end();
++i;
});
}
else if(i < 80)
{
mysqlPool.getConnection(function(err, connection)
{
console.log('db keepalive ' + i);
if(err)
{
console.log(err);
connection.end();
return false;
}
connection.changeUser(
{
user : guestUsername2,
password : guestPassword2
},
function(err)
{
if(err)
{
console.error(err.stack);
throw err;
}
else
{
connection.query(anotherQueryString);
connection.end();
++i;
}
});
});
}
}, 1000); |
+1 for this. @carlholloway's fix works perfectly. Node Version: 0.8.18 |
If the queue is empty before calling a ChangeUser sequence, the sequence will be started without being passed the handshake packet. This makes sure it gets passed. Additionally, validateEnqueue now has a test that handeshake() was called before changeUser(). fixes mysqljs#374
If the queue is empty before calling a ChangeUser sequence, the sequence will be started without being passed the handshake packet. This makes sure it gets passed. Additionally, validateEnqueue now has a test that handeshake() was called before changeUser(). fixes mysqljs#374
If the queue is empty before calling a ChangeUser sequence, the sequence will be started without being passed the handshake packet. This makes sure it gets passed. Additionally, validateEnqueue now has a test that handeshake() was called before changeUser(). fixes mysqljs#374
I'm getting the above error why trying to run changeUser on a newly connected mysql connection.
Editing Protocall.js to pass this._handshakeInitializationPacket into .start() seems to fix this.
The text was updated successfully, but these errors were encountered: