Skip to content

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
Swastik-Prakash1:swastik/i109/fix-hardcoded-logic-entrypoint
Open

fix: correct PID check, preserve stack traces, and add missing return after queue overflow reject#110
Swastik-Prakash1 wants to merge 1 commit intoaccordproject:mainfrom
Swastik-Prakash1:swastik/i109/fix-hardcoded-logic-entrypoint

Conversation

@Swastik-Prakash1
Copy link

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)

… after queue overflow reject

Signed-off-by: Swastik Prakash <swastikprakashofficial@gmail.com>
Copilot AI review requested due to automatic review settings March 19, 2026 13:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 stack support to EvalResponse and included stack traces in some rejection paths.
  • Ensured evalChildProcess stops after rejecting due to maxQueueDepth overflow.
  • Corrected the child-process PID check so PID 0 isn’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) {
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