Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Is Jitsu doing a DNS lookup every time it runs? #70

Closed
AvianFlu opened this Issue Aug 10, 2011 · 6 comments

Comments

Projects
None yet
3 participants
Contributor

AvianFlu commented Aug 10, 2011

In jitsu v0.3.11, v0.3.12, and now in v0.4.0, I've noticed that the final "nodejitsu ok" or "nodejitsu not ok" would appear, hang for a number of seconds, and then would finally exit and drop me back to my shell. Today, I started looking for a solution.

The long delay itself is from the local network here, and I've been able to remove the long delays with local configuration changes. The issue, however, is that I was seeing these exit delays even for jitsu help and jitsu config commands - things that don't seem like they would involve any network hops.

Is jitsu doing a DNS lookup every time it runs? I was able to confirm the delay for every command I tried while connected and using the local DNS, and in the case of jitsu help, I was able to make the delay disappear by disconnecting from the network completely. Once disconnected, the help message and the exit were both near-immedate.

Contributor

AvianFlu commented Aug 10, 2011

jitsu.utils.checkVersion(), https://github.com/nodejitsu/jitsu/blob/master/lib/jitsu/utils/index.js#L143-185 , is making a request to npmjs.org on every execution of jitsu. Should this still be the case for commands like help or config?

Contributor

AvianFlu commented Aug 11, 2011

Upon further investigation, this is a minor race condition. The timeout function fires properly, but jitsu doesn't check whether or not the timeout fired until after the request to registry.npmjs.org comes back. This can probably be fixed by using the timeout option in request rather than trying to use a manual timeout. I will fix this presently.

Contributor

dominictarr commented Aug 11, 2011

+1

I just wanna say, this is an A grade Issue Post.

Contributor

AvianFlu commented Aug 11, 2011

I've submitted a pull request for the timeout fix, but it has not solved the entire issue - the jitsu help and jitsu config commands still hang prior to exit, only while connected to a high-latency network. Is there another network request being made every time? The API authentication came to mind, but help and config seem like they wouldn't require auth.

@dominictarr @bmeck @indexzero any thoughts?

Contributor

bmeck commented Aug 11, 2011

checkVersion in utils/index.js is calling out to github to see if a new version is available... mmm

Contributor

bmeck commented Aug 11, 2011

Since we are running the commands regardless of whether there is a new version up and this appears to only be called in one place, I think it would be good to make this something that can be killed as the process is about to exit and just dump the message at exit.

@bmeck bmeck added a commit that referenced this issue Aug 11, 2011

@bmeck bmeck [fix] #70 request for version should be performed async and aborted i…
…f jitsu finishes before the request finishes
e189205

@bmeck bmeck closed this Aug 12, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment