[CELEBORN-1317][FOLLOWUP] HttpServer avoid Jetty's acceptor thread shrink for stopping #2450
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
HttpServer
set idle timeout to 0 in order to avoid Jetty's acceptor thread shrink for stopping.Why are the changes needed?
When the Jetty's acceptor thread shrinks before the main thread sends a signal to the thread, the issue
java.io.IOException: No such file or directory
could happen.Jetty's acceptor thread waits for a new connection request and blocked by
accept(this.fd, newfd, isaa)
in sun.nio.ch.ServerSocketChannelImpl#accept.When
org.eclipse.jetty.server.Server.doStop
is called in the main thread, the thread reaches this code.The server socket descriptor will be closed by
nd.preClose
in the main thread.Then,
accept()
in acceptor thread throws an Exception due to "Bad file descriptor" in case of macOS.After the exception is thrown, the acceptor thread will continue to fetch a task.
If the thread obtain the
SHRINK
task here, the thread will be shrink.If, the acceptor thread finishes before
NativeThread.signal
is called in the main thread, this issue happens.Environment:
Backport apache/spark#28437.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
No.