fix(backend): stop swallowing errors in judge enqueue, worker, and startup - #2
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
fix(backend): stop swallowing errors in judge enqueue, worker, and startup#2devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…artup Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Review of backend error handling surfaced a few places where errors were silently swallowed or lost. This fixes the ones with real diagnostic/operational impact.
1. Judge enqueue failures were completely swallowed (
problems.service.ts,runCode+submitCode). Thecatch {}discarded the underlying BullMQ/Redis error, so a broken queue only ever showed up as a generic 503 with no log. Worse, the compensating DB update ran unguarded inside the catch — if it threw, the intendedJUDGE_UNAVAILABLE(503) got replaced by an opaque 500 and the real cause was hidden twice over.Client contract is unchanged (still 503
JUDGE_UNAVAILABLE); the difference is the root cause is now logged and the compensating write can't mask it.2. Worker internal-error persistence could mask the real judge error (
judge/queue/worker.ts). InprocessJudgeJob's catch,await persistInternalError(...)ran unguarded beforethrow error— a persistence failure would throw and replace the original judge error that BullMQ needs to see. Wrapped it so the original error is always the one propagated.3. Startup rejection was discarded (
server.ts).void bootstrap()dropped any rejection (e.g.ensureImagesUploadDirfailing) into a silent unhandled rejection. Now it logs and exits non-zero. Also addedunhandledRejection/uncaughtExceptionlogging so nothing dies silently.4. Worker had no
errorlistener (worker.ts). Addedworker.on("error", ...)plus the same process-level handlers so BullMQ connection errors are surfaced instead of vanishing.No behavior change to the HTTP API contract; these only add logging/propagation and harden compensating paths.
Link to Devin session: https://app.devin.ai/sessions/6df705df29f24a919acaf6460fa38e6a
Requested by: @CyberStill-GmbH