Skip to content

Workers should not be started before the server #834

@BobVul

Description

@BobVul

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions