You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "123123213weqw (via GitHub)" <gi...@apache.org> on 2026/10/09 04:22:09 UTC
[PR] fix(ai): keep a late worker from resurrecting a stopped run [rocketmq-dashboard]
123123213weqw opened a new pull request, #5755:
URL: https://github.com/apache/rocketmq-dashboard/pull/5755
## What\n\n`AiRunExecutor.submit` handles a stop that lands between registration and submission by finalising the run itself (`finalizeRun` is exactly-once). But the worker task handed to the executor may already be scheduled, and when it ran, `execute` started with `markRunning`, which writes `status = RUNNING` over the terminal row the admission thread had just written.\n\n## Why it is a bug\n\nThe final state of the row became `RUNNING` with nobody owning the run: the worker's own `finalizeRun` is a no-op (the CAS already lost), and the registry entry is finished. The conversation then behaves exactly like an orphaned run — every later turn refused with 409 "busy" — until the scheduled orphan sweep reaps the row.\n\n## The fix\n\n`execute` checks `context.isTerminal()` first and returns before `markRunning`: when `submit` (or anything else) already won the terminal write, the worker must not touch the row at all. The `finally` block still runs, keeping `finalizeRun`/`regist
ry.finish` idempotent.\n\n## Test\n\nRed-first: `AiRunServiceTest.aWorkerThatStartsAfterFinalisationMustNotResurrectTheRunTest` parks the worker task in a deferred executor, stops the handle before submission (so `submit` writes `STOPPED`), then releases the queued worker and asserts the row still says `STOPPED`. Fails with `RUNNING` on the previous code, passes with the guard; the class (23 tests) stays green.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(ai): keep a late worker from resurrecting a stopped run [rocketmq-dashboard]
Posted by "github-actions[bot] (via GitHub) via commits" <co...@rocketmq.apache.org>.
github-actions[bot] closed pull request #5755: fix(ai): keep a late worker from resurrecting a stopped run
URL: https://github.com/apache/rocketmq-dashboard/pull/5755
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(ai): keep a late worker from resurrecting a stopped run [rocketmq-dashboard]
Posted by "github-actions[bot] (via GitHub) via commits" <co...@rocketmq.apache.org>.
github-actions[bot] commented on PR #5755:
URL: https://github.com/apache/rocketmq-dashboard/pull/5755#issuecomment-6782915784
This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(ai): keep a late worker from resurrecting a stopped run [rocketmq-dashboard]
Posted by "123123213weqw (via GitHub)" <gi...@apache.org>.
123123213weqw commented on PR #5755:
URL: https://github.com/apache/rocketmq-dashboard/pull/5755#issuecomment-6123349170
@lizhimins Both asks are in ([2a362c76](https://github.com/apache/rocketmq-dashboard/commit/2a362c76)):
1. Went with your option (b): the guard now lives in the write itself. `AiRunRepository.updateWhileNonTerminal` runs `UPDATE … WHERE id = ? AND status IN ('QUEUED','RUNNING')`, `markRunning` reports whether it matched a row, and `execute` bails out when it did not. Your diagnosis stood — the earlier in-memory check only narrowed the window, since a stop can land between any check and the database write; it cannot slip between the guard and the write inside one UPDATE statement. The comment now says exactly that.
2. The regression test stays in `AiRunServiceTest` for now, because the deferred-executor harness and the recording repository mock it needs live there — happy to extract a dedicated `AiRunExecutorTest` if you prefer the executor's contract in its own class. The repository mock mirrors the SQL guard (a RUNNING write only records when the last recorded row state is non-terminal), so the test still fails with `RUNNING` on the old code. The class is 23/23 on this branch merged onto the current `rocketmq-studio`.
On the #5196 adjacency: understood that you'll decide them together; this branch's guarded write composes with a request-thread fix either way. (The PR description was rewritten too — literal `\n` sequences gone, "The fix" now describes the guarded write.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org