fix: correct PID check, preserve stack traces, and add missing return after queue overflow reject#110
Open
Swastik-Prakash1 wants to merge 1 commit intoaccordproject:mainfrom
Conversation
… after queue overflow reject Signed-off-by: Swastik Prakash <swastikprakashofficial@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR tightens up error handling and edge cases in the JavaScript evaluation pipeline, improving debuggability and correctness when handling worker processes and queue limits.
Changes:
- Added
stacksupport toEvalResponseand included stack traces in some rejection paths. - Ensured
evalChildProcessstops after rejecting due tomaxQueueDepthoverflow. - Corrected the child-process PID check so PID
0isn’t treated as missing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
147
to
149
| catch (err: any) { | ||
| console.log(err); | ||
| reject({ |
Comment on lines
138
to
+142
| .catch(err => { | ||
| console.log(err); | ||
| reject({ | ||
| message: err.message | ||
| message: err.message, | ||
| stack: err.stack |
Comment on lines
173
to
176
| if(this.queue.length >= this.options.maxQueueDepth) { | ||
| reject({ maxQueueDepthExceeded: true, elapsed: 0 }); | ||
| return; | ||
| } |
Comment on lines
224
to
+227
| const workerPath = this.getWorkerPath(); | ||
| // console.debug(`Worker path: ${workerPath}`); | ||
| const worker = child_process.fork(workerPath, { timeout: options.timeout, env: {} }); | ||
| if (!worker.pid) { | ||
| if (worker.pid === undefined || worker.pid === null) { |
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.
Fix some edge cases & error handling
Fixed PID check so 0 isn’t treated as missing
Switched to console.error and added stack traces for better debugging
Stopped execution after queue overflow reject (was still pushing to queue)