Skip to content

Stop the GraphQL WebSocket deadline scheduler when the servlet is destroyed - #858

Open
sergehuber wants to merge 2 commits into
masterfrom
graphql-ws-scheduler-shutdown
Open

Stop the GraphQL WebSocket deadline scheduler when the servlet is destroyed#858
sergehuber wants to merge 2 commits into
masterfrom
graphql-ws-scheduler-shutdown

Conversation

@sergehuber

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to Require authentication for GraphQL WebSocket upgrade (master) #843. SubscriptionWebSocketFactory is only ever handed to Jetty as the socket creator and is never started or stopped as a lifecycle, so the doStop() override that was meant to stop its deadline scheduler never ran and the scheduler thread outlived each servlet instance.
  • Shut the scheduler down explicitly from GraphQLServlet.destroy(), via an explicit shutdown() on the creator, instead of relying on a lifecycle hook that is never invoked.

Test plan

  • New SubscriptionWebSocketFactoryTest.shutdown_stopsTheDeadlineScheduler; cxs-impl unit tests green locally (57)
  • CI

🤖 Generated with Claude Code

…troyed

SubscriptionWebSocketFactory is only ever handed to Jetty as the socket
creator; it is never started or stopped as a lifecycle, so the doStop()
override that was meant to shut its scheduler down never ran and the thread
outlived each servlet. Shut it down explicitly from GraphQLServlet.destroy()
instead, and cover it with a test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression test does not verify that servlet destruction invokes scheduler shutdown.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Explicitly stops the GraphQL WebSocket authentication deadline scheduler during servlet destruction.

Changes:

  • Adds servlet-driven scheduler shutdown.
  • Replaces the unused lifecycle hook with shutdown().
  • Adds scheduler shutdown unit coverage.
File summaries
File Description
GraphQLServlet.java Shuts down the socket creator during destruction.
SubscriptionWebSocketFactory.java Exposes explicit scheduler shutdown.
SubscriptionWebSocketFactoryTest.java Tests scheduler shutdown state.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The factory test only showed that shutdown() stops the executor; it would
still pass with the destroy() call removed, which is the wiring that was
broken. Add a servlet test that configures the servlet, destroys it and checks
the creator was shut down.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@asf-gitbox-commits
asf-gitbox-commits force-pushed the graphql-ws-scheduler-shutdown branch from f5deaab to 07ffe7f Compare September 4, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants