Skip to content

Issue #13602 - complete pending shutdown() future on connector stop - #15473

Closed
serhiy-bzhezytskyy wants to merge 1 commit into
jetty:jetty-12.1.xfrom
serhiy-bzhezytskyy:pr/13602-shutdown-stop-future
Closed

serhiy-bzhezytskyy wants to merge 1 commit into
jetty:jetty-12.1.xfrom
serhiy-bzhezytskyy:pr/13602-shutdown-stop-future

Conversation

@serhiy-bzhezytskyy

Copy link
Copy Markdown

Closes #13602.

The future returned by Connector.shutdown() was never completed if Connector.stop() was called afterwards while an HTTP/2 client was connected. doStop() cleared _shutdown before the asynchronous HTTP/2 endpoint disconnect fired onEndPointClosed(), so the final Shutdown.check() was skipped and the future stayed pending. (HTTP/1.1 disconnects synchronously enough to avoid the window, which matches the reporter's observation that swapping to HTTP/1.1 returns the future as expected.)

Fix: isShutdownDone() returns true once the connector is no longer running (a stopped connector has no remaining load), and doStop() checks the pending shutdown before clearing _shutdown.

Added GracefulShutdownTest cases for shutdown()-then-stop(), including with a stream still active during shutdown (which a graceful-close-timing fix alone would not cover).

Same graceful-shutdown area as #13569 / #15368, but independent of them (verified this fix resolves #13602 on its own).

The future returned by connector.shutdown() was orphaned if connector.stop()
followed while an HTTP/2 client was connected: doStop() cleared _shutdown
before the asynchronous HTTP/2 endpoint disconnect fired onEndPointClosed(),
so the final Shutdown.check() was skipped and the future never completed
(HTTP/1.1 disconnects synchronously enough to avoid this).

isShutdownDone() now returns true once the connector is no longer running
(stop() implies no remaining load), and doStop() checks the pending shutdown
before clearing _shutdown.

Adds GracefulShutdownTest tests for shutdown()-then-stop(), including with an
active stream.

Signed-off-by: serhiy-bzhezytskyy <me@serhiy-bzhezytskyy.com>
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Author

CI is red here on one test — ConcurrentRequestsTest.testConcurrentGoodRequestsWithBadRequestsWithSameConnection on JDK 17. I've reproduced that failure on pristine jetty-12.1.x without this change, so I'm fairly confident it's pre-existing rather than caused by the PR.

Could someone re-trigger the build when convenient? The branch is 2 commits behind jetty-12.1.x (7403f886c ForwardedRequestCustomizer, 1ca74582e IPv6 in HttpURI) — I can rebase first if you'd prefer.

@serhiy-bzhezytskyy

Copy link
Copy Markdown
Author

Closing this for the same reason as #15472: Graceful.shutdown() is not meant to be called directly — it is an implementation detail of LifeCycle.stop(), per @lorban in #13569 (comment). The future this PR completes only exists if shutdown() is called directly, which is not the supported path, so the defect goes away with the usage rather than needing a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Connector#shutdown() gets stuck if Connector#close() is called with HTTP/2 clients.

1 participant