-
Notifications
You must be signed in to change notification settings - Fork 2.5k
process.domain become undefined after mysql.query(... #308
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
I tested your example (only without |
That's odd. I tried without connect and makes no difference. aj$ node -v I'll try to reproduce my issue independently of the rest of my code and update here ... |
Just to clarify, I'm using node v0.8.12, [email protected] |
I was mistaken when I said that .connect made no difference. Actually it works without .connect. :) So the bug is that using the explicit connect method causes subsequent queries to destroy the domain. |
It's odd but... I was re-reading this issue and copied your code with [email protected] and it just works. Could you confirm this? |
I really don't know/understand what was happening but I've stopped using domains as a result - sorry I can't help further and thanks for taking the time to try to assist. |
I'm running into the same problem with [email protected] and mysql@alpha7
outputs
|
This is just how domains currently work. Even https://github.com/mranney/node_redis and other modules have this issue. It has to do with using callbacks; you need to use var d = domain.create();
d.run(function () {
client.query('...', d.intercept(function (rows) {
// ... use rows (note, first arguments error was "intercepted" by the domain)
}));
}); |
yeah I know that domain#run has that issue and I've been able to get around it by using domain#enter and domain#exit at other portions of the code was trying to avoid wrapping the callbacks. Your solution works thanks for your help doug |
As of version |
Experimenting with v8s new process.domain and noticed that my newly created domain becomes 'undefined' if I do a query:
(Unless of course I'm doing something completely stupid which is of course entirely possible!)
The text was updated successfully, but these errors were encountered: