Skip to content

cluster.worker.id not present when using preload module (-r) #1269

@megastef

Description

@megastef

I'm using for logging for each forked worker the property worker.id - this works fine for node 0.10,0.12 and io.js up to 1.5 - in 1.6.2, only when I use the new -r / preload option to preload the logging module I get following error:

  postfix = '.worker-' + cluster.worker.id 
                                       ^
  TypeError: Cannot read property 'id' of undefined

How can this happen?

The related source code:

if (!cluster.isMaster)
    postfix = '.worker-' + cluster.worker.id 

https://nodejs.org/api/cluster.html#cluster_cluster_worker
https://nodejs.org/api/cluster.html#cluster_worker_id

Metadata

Metadata

Assignees

No one assigned

    Labels

    clusterIssues and PRs related to the cluster subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions