Skip to content

cluster: worker doesn't react on message #39854

@relloccate

Description

@relloccate

Hi there.

I have a problem:
The Worker doesn't react on "message" event from the Primary with: type: "module" enabled in package.json
But the Primary is react on "message" event from the worker

Without type: "module" both works.

win10 x64 (node v14.17.5 and v16.7.0)
Guys, any fixes? Thanks.

Example:

import cluster from 'cluster';

if (cluster.isMaster) {
    const worker = cluster.fork();

    worker.on('message', message => {
        // will log the message
        console.log(message);
    });

    worker.send('From Master');
} else {
    process.on('message', message => {
        // will not log the message
        console.log(message);
    });

    process.send('From Worker');
}

Doesn't work ONLY with enabled node.js imports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clusterIssues and PRs related to the cluster subsystem.esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy