Skip to content

When a server fails to start it does not cleanup its WebSocketWorker threads #668

Closed
@vsch

Description

@vsch

When server start fails because address is already in use, it calls stop which causes a null pointer exception because selector is not yet initialized.

This exception causes the server not to interrupt its web socket workers.

Expected Behavior

cleanup web workers if server start fails

Current Behavior

Leaves the workers running

Possible Solution

In WebSocket server stop(int) method

		synchronized ( this ) {
			if( selectorthread != null  ) {
				selector.wakeup();
				selectorthread.join( timeout );
			}
		}

change to:

		synchronized ( this ) {
			if( selectorthread != null  ) {
				if (selector != null) selector.wakeup();
				selectorthread.join( timeout );
			}
		}

Steps to Reproduce (for bugs)

1.Start a server
2. Start a second server with the same address
3. Once it fails the Worker threads are still alive
4.

Debug log (for bugs)

Context

Your Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions