Skip to content
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

Aerospike timeout error using node debug #140

Closed
anuranjit opened this issue Aug 4, 2016 · 11 comments
Closed

Aerospike timeout error using node debug #140

anuranjit opened this issue Aug 4, 2016 · 11 comments
Assignees
Labels
Milestone

Comments

@anuranjit
Copy link

Whenever i run the node server in debug mode.All of my queries to Aerospike result in Timeout error. The same thing works when i dont use debug?

@jhecking jhecking added the bug label Aug 5, 2016
@jhecking jhecking self-assigned this Aug 5, 2016
@jhecking
Copy link
Contributor

jhecking commented Aug 5, 2016

Thanks for reporting this issue, @anuranjit. I am able to reproduce it and will take a look to see what is causing this.

@jhecking
Copy link
Contributor

jhecking commented Aug 5, 2016

To clarify, this seems to only happen when running Node.js with the interactive debugger enabled:

$ node debug test.js
< Debugger listening on [::]:5858
connecting to 127.0.0.1:5858 ... ok
break in test.js:1
> 1 const Aerospike = require('aerospike')
  2 var key = new Aerospike.Key('test', 'test', 'test')
  3 Aerospike.connect((err, client) => {
cont
< connected to cluster successfully
< error fetching key: AEROSPIKE_ERR_TIMEOUT

In the non-interactive debug mode (node --debug test.js) this does not happen.

Furthermore, when program execution is continued (using the cont command) quickly enough, the timeout also does not happen.

I think this has to do with the way libuv tracks time. To improve efficiency, libuv captures the current time at the beginning of each event loop iteration and uses that timestamp throughout the execution of the iteration. If something (e.g. the interactive debugger) blocks the execution of the event loop for an extended period of time this seems to be able to cause timeouts like we are seeing here.

A call to uv_update_time at the time when the client initializes it's event loop handles fixes the problem. Though it's entirely possible that you will run into the same issue again if halt program execution by placing breakpoints in your code. So I'm not sure that adding the uv_update_time call is useful.

If you are debugging a longer running Node.js application, maybe you should try using node --debug instead of node debug?

@jhecking jhecking changed the title Aerospike timeout error Aerospike timeout error using node debug Aug 5, 2016
@anuranjit
Copy link
Author

anuranjit commented Aug 5, 2016

@jhecking Thanks for the reply. Will this be fixed in any future version?. Is there any workaround so that I can use interactive debugging?
For increasing the time out should I make a temporary change in my C client code?

@jhecking
Copy link
Contributor

jhecking commented Aug 5, 2016

@anuranjit, I have committed the uv_update_time work-around to master. If you can build the module from source you can give it a try. Would be good to hear your feedback, whether this actually solves the problem or not. Otherwise, you'll have to wait for the next release, which is tentatively scheduled for next week.

@anuranjit
Copy link
Author

@jhecking Thanks. I will try it out and let you know.

@jhecking
Copy link
Contributor

@anuranjit, does the work-around I added work for you?

@jhecking
Copy link
Contributor

Work-around (9bed04e) is included in v2.3.0. Closing this. Please reopen or file a new issue if there are still issues with using the aerospike module using the interactive debugger.

@jhecking jhecking added this to the v2.3.0 milestone Aug 11, 2016
@anuranjit
Copy link
Author

@jhecking Thanks for the fix. This is working now.

@anuranjit
Copy link
Author

@jhecking It is not working again 😭 . It worked for sometime but now again the same problem is happening.

@jhecking
Copy link
Contributor

@anuranjit, any idea what might have changed between 10 days ago and now? Are you doing the debugging the same way as before?

@anuranjit
Copy link
Author

@jhecking Actually it was not working earlier also. I was restarting the interactive debugger frequently. So it used to be work for some time. Once I keep breakpoint for slightly long duration than it starts failing again. Plus after this even if I keep the breakpoint on for short duration (~7s) it fails .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants