Skip to content

process._tickCallback - tock is undefinedΒ #6346

Closed
@dnwe

Description

@dnwe
  • Version: v4.3.1
  • Platform: Linux 4.4.0-1-amd64
  • Subsystem: process
node.js:342
          callback = tock.callback;
                         ^

TypeError: Cannot read property 'callback' of undefined
    at process._tickCallback (node.js:342:26)

TL;DR the same issue that someone else previously reported in #4308 (and closed), but with a reduced testcase.

Several of our customers are seeing this after moving from Node 0.12.x to node 4.x.x. The issue appears to be readily reproducible for me on Node 4.x.x (both 4.3.1 and 4.4.3 tested) using the example app here against an mqlight backend, but appears to be "fixed" on Node 5.10.1. Essentially, after some period of the app running, tickInfo[kLength] seems to have got out of sync and is greater-than nextTickQueue.length - hence tock ends up being undefined.

    function _tickCallback() {
      var callback, args, tock;

      do {
        while (tickInfo[kIndex] < tickInfo[kLength]) {
          tock = nextTickQueue[tickInfo[kIndex]++];
          callback = tock.callback;       // <------- line 341. tock is undefined
          args = tock.args;

Further debugging on 4.3.1 /seemed/ to indicate that the issue occurred in nextTick, after pushing the new TickObject nextTickQueue.length was 0 (descoped?), but tickInfo[kLength] was incremented regardless and hence they became out of step.

Applying this patch to src/node.js and re-building seemed to fix the issue for me...but I can't explain why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    processIssues and PRs related to the process subsystem.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions