GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — When worker thread throw an error, main thread recieves exit code 0 instead of 1 · Issue #21707 · nodejs/node

When worker thread throw an error, main thread recieves exit code 0 instead of 1 #21707

New issue
Copy link
New issue
Copy link
Closed
Closed
When worker thread throw an error, main thread recieves exit code 0 instead of 1#21707
Copy link
Labels
good first issueIssues that are suitable for first-time contributors.workerIssues and PRs related to the worker_threads module and Worker API.

Description

@ciffelia
ciffelia
opened on Jul 8, 2018
Issue body actions
  • Version: v10.6.0
  • Platform:
    • Windows 64-bit
    • Linux 29d0523d5d87 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018 x86_64 Linux (Alpine Linux on Docker)
    • Linux 30e69b847957 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018 x86_64 GNU/Linux (Debian on Docker)
  • Subsystem: worker_threads

Reproduction code

const { Worker, isMainThread } = require('worker_threads');

if (isMainThread) {
  const worker = new Worker(__filename);
  worker.on('error', err => {
    console.log(`Worker threw an error: ${err.message}`);
  });
  worker.on('exit', code => {
    console.log(`Worker finished with exit code ${code}`);
  });
} else {
  throw new Error('error!');
}

Expected output

Worker threw an error: error!
Worker finished with exit code 1

Actual output

Worker threw an error: error!
Worker finished with exit code 0

Activity

  1. targos
    added
    workerIssues and PRs related to the worker_threads module and Worker API.
    on Jul 8, 2018
  2. targos commented on Jul 8, 2018

    @targos
    targos
    on Jul 8, 2018
    Member
    More actions

    @nodejs/workers

  3. addaleax commented on Jul 8, 2018

    @addaleax
    addaleax
    on Jul 8, 2018
    Member
    More actions

    I think it might be enough to set process.exitCode in fatalException in lib/internal/worker.js?

    Reacted by Oji Ishimori
  4. addaleax
    added
    good first issueIssues that are suitable for first-time contributors.
    on Jul 8, 2018
  5. lundibundi commented on Jul 8, 2018

    @lundibundi
    lundibundi
    on Jul 8, 2018
    Member
    More actions

    I've been looking into this one and would like to work on it, is it okay?

    Reacted by Benjamin Gruenbaum and Dimitrii Nemkov
    Reacted by Oji Ishimori and Anna Henningsen
  6. lundibundi
    added a commit that references this issue on Jul 8, 2018

    workers: fix invalid exit code in parent upon uncaught exception

    483cdec
  7. addaleax
    closed this as completedin 1e9c3f8on Jul 10, 2018
  8. targos
    added a commit that references this issue on Jul 12, 2018

    workers: fix invalid exit code in parent upon uncaught exception

    25fef3d
  9. sjarmak
    added a commit that references this issue on Jul 27, 2026

    workers: fix invalid exit code in parent upon uncaught exception

    1e9c3f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.workerIssues and PRs related to the worker_threads module and Worker API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.