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

Workers should not be started before the server #834

Closed
BobVul opened this issue Jan 7, 2019 · 2 comments
Closed

Workers should not be started before the server #834

BobVul opened this issue Jan 7, 2019 · 2 comments

Comments

@BobVul
Copy link

BobVul commented Jan 7, 2019

Describe the bug
Currently workers are started in the server's constructor, rather than in the server's run method. This means the simple act of constructing the server instance will start all worker threads, which will then persist until the server is started/run and then stopped.

I feel like the correct way to handle this is to only start the workers in run().

To Reproduce
Steps to reproduce the behavior:
new WebSocketServer(); anywhere will start the worker threads, which persist.

Example application to reproduce the issue
For example, this trivial application will never exit because the threads keep it alive:

https://gist.github.com/BobVul/707d04de68ad0a603791b1a05ca3e809

Expected behavior
The threads should not be started until start() or run() are called.

Debug log
The the debug log ('WebSocketImpl.DEBUG = true') to help explain your problem.

Environment(please complete the following information):

  • Version used: 1.3.9
  • Java version:
  • Operating System and version:
  • Endpoint Name and version:
  • Link to your project:

Additional context
Add any other context about the problem here.

@marci4
Copy link
Collaborator

marci4 commented Jan 9, 2019

Hello @BobVul ,

thank you for your bug report!

Any PR is more than welcome!

Best regards,
marci4

marci4 added a commit that referenced this issue Feb 10, 2019
Fix issue #834 by starting WebSocketWorker of the WebSocketServer in the start function
@marci4
Copy link
Collaborator

marci4 commented Feb 10, 2019

Fixed with #850

@marci4 marci4 closed this as completed Feb 10, 2019
@marci4 marci4 added this to the Release 1.4.0 milestone Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants