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

The TcpNetServerConnectionFactory.run() must not block on the loop forever #8852

Closed
artembilan opened this issue Jan 5, 2024 · 0 comments
Closed

Comments

@artembilan
Copy link
Member

The current logic is like:

			while (true) {
				acceptConnectionAndExecute();
			}

This blocks a thread in the executor forever.
Fix it to while (isActive()) { to properly react to the stop() call.

Otherwise with an internal executor we wait on the:

					if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) { // NOSONAR magic number
						logger.debug("Forcing executor shutdown");
						executorService.shutdownNow();

Which does not happen if we exit from the loop normally.

@artembilan artembilan added this to the 6.3.0-M1 milestone Jan 5, 2024
artembilan added a commit that referenced this issue Jan 5, 2024
Fixes: #8852

The `while (true) {` causes the thread to be blocked forever.
The `stop()` waits on the `if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) {` the whole time

* Fix with the `while (isActive()) {`
* Remove the `ConnectionFactoryTests.testEarlyCloseNet()` since we cannot reach expectations because of
race condition between `start()` and `stop()`

**Cherry-pick to `6.2.x` & `6.1.x`**

(cherry picked from commit 0b60dfc)
artembilan added a commit that referenced this issue Jan 5, 2024
Fixes: #8852

The `while (true) {` causes the thread to be blocked forever.
The `stop()` waits on the `if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) {` the whole time

* Fix with the `while (isActive()) {`
* Remove the `ConnectionFactoryTests.testEarlyCloseNet()` since we cannot reach expectations because of
race condition between `start()` and `stop()`

**Cherry-pick to `6.2.x` & `6.1.x`**

(cherry picked from commit 0b60dfc)
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