Document known gap: storeall doesn't wait for the app's own background threads
InitServlet.destroy() now holds incoming requests and waits (briefly) for HttpController's request count to hit zero before calling Registry.storeAll() - but that counter only tracks threads servicing HTTP requests. A thread the webapp spun up itself (e.g. the order schedulers InitServlet.init() starts) isn't tracked by it at all, and can still be running - and still writing - while storeall takes its snapshot. storeAll()'s synchronization still keeps this from corrupting the DB, and stopwaitsecs=300 (sportrum-ansible) still keeps supervisord from killing Tomcat mid-write - neither of those is undone by this. But a write from an untracked background thread can still land after storeall's pass and never get persisted. Properly closing it needs a real thread manager in the webapp that can halt everything it started, not just hold new requests. Noting it here, next to the code that currently doesn't do that, so it isn't forgotten before that manager exists. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tj4SF2BGFxgoRYrCAzNpDb
This commit is contained in:
parent
72b159c997
commit
a34ea9a9bc
1 changed files with 22 additions and 0 deletions
22
upgrade.sh
22
upgrade.sh
|
|
@ -68,6 +68,28 @@ case "$mode" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# KNOWN GAP (2026-10-01): storeall is not actually guaranteed to see a
|
||||
# fully quiesced app at the moment it runs. InitServlet.destroy() calls
|
||||
# HttpController.setRequestsOnHold(true) and waits (up to 2s) for
|
||||
# HttpController.getRequestCount() to hit zero before calling
|
||||
# icp.Registry.storeAll() - but that only tracks threads servicing
|
||||
# incoming HTTP requests through HttpController. Any background thread the
|
||||
# webapp itself started (e.g. the order schedulers InitServlet.init() spins
|
||||
# up - see "Starting order schedulers" in InitServlet.java) is invisible to
|
||||
# that counter and can still be running, and potentially still mutating
|
||||
# state, while storeall takes its snapshot. storeAll()'s own
|
||||
# synchronization keeps this from corrupting the DB, but a write from one
|
||||
# of these threads can still land after storeall's pass and never get
|
||||
# persisted before shutdown.
|
||||
#
|
||||
# Not fixed by anything in this script or by Tomcat's stopwaitsecs (see
|
||||
# sportrum-ansible's supervisord.conf) - that only protects storeall
|
||||
# itself from being killed mid-write, it does nothing about threads other
|
||||
# than the app's own request-handling threads. Properly closing this needs
|
||||
# a real thread manager in the webapp that can be told to halt (or at
|
||||
# least pause/join) every thread it started, not just hold new requests,
|
||||
# called from InitServlet.destroy() before storeAll() runs. Not
|
||||
# implemented yet - noted here so it isn't forgotten.
|
||||
running=$(./tomcat_ctl.sh status | grep "tomcat8 is stopped")
|
||||
if [ "x$running" == "x" ]; then
|
||||
printf "Call server command storeall.."; sleep 2
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue