You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But neither success(), nor failure() is ever called.
(3) findAll
Task.findAll().success(function(tasks) {
// never gets here...
}).failure(function (err) {
// or here...
res.send('Error: ' + err);
});
---- Setup ---
(1) Open the DB
var Sequelize = require('sequelize'); // mysql by default
var sequelize = new Sequelize('myDbName', 'root', 'mypassword', {
host: "127.0.0.0",
port: 3306
});
But it neither success(), nor failure() is ever called.
(3) Task.findAll().success(function(tasks) {
// never gets here...
}).failure(function (err) {
// or here...
res.send('Error: ' + err);
});
---- Setup ---
(1) Open the DB
var Sequelize = require('sequelize'); // mysql by default
var sequelize = new Sequelize('myDbName', 'root', 'mypassword', {
host: "127.0.0.0",
port: 3306
});
@sdepold No, I should have mentioned that -- the .on('success') and on('failure') methods do not get called, either. That's why I switched to just success(function(data){}) and failure(err).
Any ideas of how to track this down?
Connecting with the 'mysql' module works fine and it returns data using the same query immediately.
Am Mittwoch, 1. Februar 2012 um 19:51 schrieb bfoust:
@sdepold No, I should have mentioned that -- the .on('success') and on('failure') methods do not get called, either. That's why I switched to just success(function(data){}) and failure(err).
Any ideas of how to track this down?
Connecting with the 'mysql' module works fine and it returns data using the same query immediately.
And the task table already exists (and has many more fields than I use in my test code above). Is there a way to turn on verbose mode to see where sequelize is hanging?
hmm no not really. can you check another, new model, create some entries and read them? can u also check the find method? are you sure that u didnt missspelled smth?
And the task table already exists (and has many more fields than I use in my test code above). Is there a way to turn on verbose mode to see where sequelize is hanging?
Interesting. I'm not sure if it's switching to use find(), calling sync() which I wasn't doing before, or just using a new table, but now failure() gets called after a long delay:
var Test = sequelize.define('test', {
test_id: Sequelize.INTEGER,
test_name: Sequelize.TEXT,
},
{
underscored: true,
freezeTableName: true
}
);
Test.sync();
Test.create({test_id:1, test_name:'Entry 1'});
Test.find({where:{test_id: 1}}).success(function(tasks) {
console.log("=====> Test Find succeeded");
}).failure(function (err) {
console.log("=====> Test Find failed.");
});
Executing: INSERT INTO test (test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:21:54','2012-02-01 17:21:54');
Executing: SELECT * FROM test WHERE test_id=1 LIMIT 1;
Executing: CREATE TABLE IF NOT EXISTS test (test_id INTEGER, test_name TEXT, id INTEGER NOT NULL auto_increment , created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;
^[=====> Test Find failed.
This last line appears after more than 2-3 minutes elapse. Why would it be hanging the SELECT until timing out?
The same code calling findAll() gives similar output, but I didn't wait long enough to see if the timeout leads to failure() being called:
Executing: INSERT INTO test (test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:16:47','2012-02-01 17:16:47');
Executing: SELECT * FROM test;
Executing: CREATE TABLE IF NOT EXISTS test (test_id INTEGER, test_name TEXT, id INTEGER NOT NULL auto_increment , created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;
Note: the 'test' table is never created, although:
a) there is no 'test' table, and
b) the CREATE TABLE IF NOT EXISTS is being executed
ah! please do Task.sync().success and go on inside the success callback. you r trying to create table entries into a table which isnt existing. check the log -> insert before create table
Interesting. I'm not sure if it's switching to use find(), calling sync() which I wasn't doing before, or just using a new table, but now failure() gets called after a long delay:
var Test = sequelize.define('test', {
test_id: Sequelize.INTEGER,
test_name: Sequelize.TEXT,
},
{
underscored: true,
freezeTableName: true
}
);
Test.sync();
Test.create({test_id:1, test_name:'Entry 1'});
Test.find({where:{test_id: 1}}).success(function(tasks) {
console.log("=====> Test Find succeeded");
}).failure(function (err) {
console.log("=====> Test Find failed.");
});
Executing: INSERT INTO test (test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:21:54','2012-02-01 17:21:54');
Executing: SELECT * FROM test WHERE test_id=1 LIMIT 1;
Executing: CREATE TABLE IF NOT EXISTS test (test_id INTEGER, test_name TEXT, id INTEGER NOT NULL auto_increment , created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;
^[=====> Test Find failed.
This last line appears after more than 2-3 minutes elapse. Why would it be hanging the SELECT until timing out?
The same code calling findAll() gives similar output, but I didn't wait long enough to see if the timeout leads to failure() being called:
Executing: INSERT INTO test (test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:16:47','2012-02-01 17:16:47');
Executing: SELECT * FROM test;
Executing: CREATE TABLE IF NOT EXISTS test (test_id INTEGER, test_name TEXT, id INTEGER NOT NULL auto_increment , created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;
Interesting. I'm not sure if it's switching to use find(), calling sync() which I wasn't doing before, or just using a new table, but now failure() gets called after a long delay:
var Test = sequelize.define('test', {
test_id: Sequelize.INTEGER,
test_name: Sequelize.TEXT,
},
{
underscored: true,
freezeTableName: true
}
);
Test.sync();
Test.create({test_id:1, test_name:'Entry 1'});
Test.find({where:{test_id: 1}}).success(function(tasks) {
console.log("=====> Test Find succeeded");
}).failure(function (err) {
console.log("=====> Test Find failed.");
});
Executing: INSERT INTO test (test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:21:54','2012-02-01 17:21:54');
Executing: SELECT * FROM test WHERE test_id=1 LIMIT 1;
Executing: CREATE TABLE IF NOT EXISTS test (test_id INTEGER, test_name TEXT, id INTEGER NOT NULL auto_increment , created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;
^[=====> Test Find failed.
This last line appears after more than 2-3 minutes elapse. Why would it be hanging the SELECT until timing out?
The same code calling findAll() gives similar output, but I didn't wait long enough to see if the timeout leads to failure() being called:
Executing: INSERT INTO test (test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:16:47','2012-02-01 17:16:47');
Executing: SELECT * FROM test;
Executing: CREATE TABLE IF NOT EXISTS test (test_id INTEGER, test_name TEXT, id INTEGER NOT NULL auto_increment , created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;
So I am seeing something akin to this, but only after some amount of time where things have been working fine.
That is, eventually my selects (and, it seems, all other db calls) will never call back either their success or failure methods. I'm suspicious it has something to do with the database connection being gone for some reason, but sequelize believing it's still there. My database has an interactive/wait_timeout of 8 hours, so it seems unlikely that it's the db closing the connection (as I believe I've seen this happen less than 8 hours after launching my node process).
I am tempted to try pulling the latest connection pooling code in the hopes that if there is a bug in the current connections code I could avoid it.
I wish I had a better reproduction case. One thing that might be helpful would be to emit events on connect/disconnect from mysql. At least then I could try to have some logging to get a better grip on what's happening. (Of course, if my theory is right, the mysql connection would be going away but sequelize would not realize and would not emit a disconnect.)
Some more info: when I get into this state, where my db calls are just hanging. If I either a) restart node or b) restart mysql suddenly new calls work.
The way I read the original is that if there is no this.client._queue it will return false, indicating that there are connections. That seems incorrect to me. My revision attempts to say: if there is a client queue and it has items, then we still have connections.
But frankly, I get confused by inverted booleans, maybe it would be better to do:
I'm assuming this is fixed, as it's a very old version of SequelizeJS as well, and I've never seen this problem occur. @andyburke if you ever experience this problem with 1.6 or 1.7 please let me know, but for now I'm closing the ticket/cleaning up the issues page :)
Activity
sdepold commentedon Feb 1, 2012
and is .on('success') working?
Am 01.02.2012 um 17:31 schrieb [email protected]:
bfoust commentedon Feb 1, 2012
@sdepold No, I should have mentioned that -- the .on('success') and on('failure') methods do not get called, either. That's why I switched to just success(function(data){}) and failure(err).
Any ideas of how to track this down?
Connecting with the 'mysql' module works fine and it returns data using the same query immediately.
sdepold commentedon Feb 1, 2012
will check it in an hour.
Am Mittwoch, 1. Februar 2012 um 19:51 schrieb bfoust:
sdepold commentedon Feb 1, 2012
ok i just checked locally. can you please try this as well:
i already had this database/table so i didn't call sync but added an entry to the table via sequel pro
sdepold commentedon Feb 1, 2012
which version are u using btw? the log is very strange:
SELECT * FROM taskit should beSELECT * FROMtask``sdepold commentedon Feb 1, 2012
and i tried your example:
bfoust commentedon Feb 1, 2012
Yes, The backticks are difficult to get to show up. Here it is more accurately:
Executing: SELECT * FROM
task;I'm using version 1.3.3:
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
And the task table already exists (and has many more fields than I use in my test code above). Is there a way to turn on verbose mode to see where sequelize is hanging?
sdepold commentedon Feb 1, 2012
hmm no not really. can you check another, new model, create some entries and read them? can u also check the find method? are you sure that u didnt missspelled smth?
Am 01.02.2012 um 21:10 schrieb [email protected]:
bfoust commentedon Feb 1, 2012
OK, I'll try find() and report back.
What is smth?
On Wed, Feb 1, 2012 at 1:13 PM, Sascha Depold <
[email protected]
bfoust commentedon Feb 2, 2012
Interesting. I'm not sure if it's switching to use find(), calling sync() which I wasn't doing before, or just using a new table, but now failure() gets called after a long delay:
Executing: INSERT INTO
test(test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:21:54','2012-02-01 17:21:54');Executing: SELECT * FROM
testWHEREtest_id=1 LIMIT 1;Executing: CREATE TABLE IF NOT EXISTS
test(test_idINTEGER,test_nameTEXT,idINTEGER NOT NULL auto_increment ,created_atDATETIME NOT NULL,updated_atDATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;^[=====> Test Find failed.
This last line appears after more than 2-3 minutes elapse. Why would it be hanging the SELECT until timing out?
The same code calling findAll() gives similar output, but I didn't wait long enough to see if the timeout leads to failure() being called:
Executing: INSERT INTO
test(test_id,test_name,id,created_at,updated_at) VALUES (1,'Entry 1',NULL,'2012-02-01 17:16:47','2012-02-01 17:16:47');Executing: SELECT * FROM
test;Executing: CREATE TABLE IF NOT EXISTS
test(test_idINTEGER,test_nameTEXT,idINTEGER NOT NULL auto_increment ,created_atDATETIME NOT NULL,updated_atDATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB;Note: the 'test' table is never created, although:
a) there is no 'test' table, and
b) the CREATE TABLE IF NOT EXISTS is being executed
sdepold commentedon Feb 2, 2012
something :) it would also help to get the schema of that specific table.
Am 01.02.2012 um 23:24 schrieb [email protected]:
sdepold commentedon Feb 2, 2012
ah! please do Task.sync().success and go on inside the success callback. you r trying to create table entries into a table which isnt existing. check the log -> insert before create table
Am 02.02.2012 um 02:30 schrieb [email protected]:
sdepold commentedon Feb 2, 2012
hmm you never seem to use .success when syncing, creating or finding objects. btw whoch version of mysql r u using?
Am 02.02.2012 um 02:30 schrieb [email protected]:
andyburke commentedon Apr 24, 2012
So I am seeing something akin to this, but only after some amount of time where things have been working fine.
That is, eventually my selects (and, it seems, all other db calls) will never call back either their success or failure methods. I'm suspicious it has something to do with the database connection being gone for some reason, but sequelize believing it's still there. My database has an interactive/wait_timeout of 8 hours, so it seems unlikely that it's the db closing the connection (as I believe I've seen this happen less than 8 hours after launching my node process).
I am tempted to try pulling the latest connection pooling code in the hopes that if there is a bug in the current connections code I could avoid it.
I wish I had a better reproduction case. One thing that might be helpful would be to emit events on connect/disconnect from mysql. At least then I could try to have some logging to get a better grip on what's happening. (Of course, if my theory is right, the mysql connection would be going away but sequelize would not realize and would not emit a disconnect.)
andyburke commentedon Apr 25, 2012
Some more info: when I get into this state, where my db calls are just hanging. If I either a) restart node or b) restart mysql suddenly new calls work.
andyburke commentedon Apr 25, 2012
Should this:
Instead be this:
The way I read the original is that if there is no this.client._queue it will return false, indicating that there are connections. That seems incorrect to me. My revision attempts to say: if there is a client queue and it has items, then we still have connections.
But frankly, I get confused by inverted booleans, maybe it would be better to do:
Thoughts?
andyburke commentedon Apr 25, 2012
Sorry, I should point out that that code is here:
https://github.com/sdepold/sequelize/blob/master/lib/dialects/mysql/connector-manager.js#L114
durango commentedon Jun 19, 2013
I'm assuming this is fixed, as it's a very old version of SequelizeJS as well, and I've never seen this problem occur. @andyburke if you ever experience this problem with 1.6 or 1.7 please let me know, but for now I'm closing the ticket/cleaning up the issues page :)