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

shutdown() does not gracefully drain / clear generic pools #61

Closed
rossj opened this issue Aug 4, 2019 · 3 comments
Closed

shutdown() does not gracefully drain / clear generic pools #61

rossj opened this issue Aug 4, 2019 · 3 comments

Comments

@rossj
Copy link
Contributor

rossj commented Aug 4, 2019

Related to #50. I've noticed that after trying to do a graceful shutdown(), my process hangs around for about ~30 seconds. Using wtfnode it seems that there is still a timer from generic-pool that keeps the process running for a while:

[WTF Node?] open handles:
- File descriptors: (note: stdio always exists)
  - fd 1 (tty) (stdio)
  - fd 2 (tty) (stdio)
- Timers:
  - (1000 ~ 1000 ms) (anonymous) @ /code/node_modules/generic-pool/lib/generic-pool.js:256

I'm guessing this is part of generic-pool's idle handling. idleTimeoutMillis defaults to 30s which is about the time I'm seeing before actual process exit.

Perhaps the rascal vhost should drain and clear the pools during shutdown?

From the generic-pool docs:

/**
 * Step 3 - Drain pool during shutdown (optional)
 */
// Only call this once in your application -- at the point you want
// to shutdown and stop using this pool.
myPool.drain().then(function() {
  myPool.clear();
});

I'm new to rascal but I'd be happy to work on a PR if you'd like this change.

@cressie176
Copy link
Collaborator

Hi @rossj. Thanks for diagnosing this and the offer of a PR. The channel pooling code is a little ugly, so I'll sort shortly.

cressie176 pushed a commit that referenced this issue Aug 4, 2019
@cressie176
Copy link
Collaborator

Should be fixed in rascal@4.6.0

@rossj
Copy link
Contributor Author

rossj commented Aug 4, 2019

Cool, my process exits immediately now. Thanks!

@rossj rossj closed this as completed Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants