clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.66k stars 125 forks source link

Cannot read property 'name' of null #432

Open tsondergaard opened 3 years ago

tsondergaard commented 3 years ago

When my program is running with sqlite3 as database I get an error like this when I run "clinic bubbleprof" on it:

/usr/local/lib/node_modules/clinic/node_modules/@nearform/bubbleprof/analysis/aggregate/mark-module-aggregate-nodes.js:25
      aggregateNode.mark.set(1, firstModule.name)
                                            ^

TypeError: Cannot read property 'name' of undefined
    at MarkModuleAggregateNodes._transform (/usr/local/lib/node_modules/clinic/node_modules/@nearform/bubbleprof/analysis/aggregate/mark-module-aggregate-nodes.js:25:45)
    at MarkModuleAggregateNodes.Transform._read (internal/streams/transform.js:205:10)
    at MarkModuleAggregateNodes.Transform._write (internal/streams/transform.js:193:12)
    at writeOrBuffer (internal/streams/writable.js:358:12)
    at MarkModuleAggregateNodes.Writable.write (internal/streams/writable.js:303:10)
    at MarkPartyAggregateNodes.ondata (internal/streams/readable.js:745:22)
    at MarkPartyAggregateNodes.emit (events.js:376:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at MarkPartyAggregateNodes.Readable.push (internal/streams/readable.js:223:10)

I have dumped out the content of aggregateNode below. frames is empty and the program obviously does not expect this.

aggregateNode: {
  "aggregateId": 280,
  "parentAggregateId": 215,
  "name": null,
  "children": [],
  "mark": [
    "external",
    null,
    null
  ],
  "type": "sqlite3.Statement.All",
  "frames": [],
  "sources": [
    {
      "asyncId": 267,
      "parentAsyncId": 256,
      "triggerAsyncId": 256,
      "executionAsyncId": 256,
      "init": 3468301.664,
      "before": [
        3468301.894
      ],
      "after": [
        3468302.024
      ],
      "destroy": 3468306.749
    }
  ]
}

This issue appears to be the same as clinicjs/node-clinic-bubbleprof#303 but with different trigger.

sentenzadorval commented 3 years ago

Hi,

I'm facing the same issue (also using sqlite) when using command line bubbleprof to generate the report:

$ clinic bubbleprof --visualize-only 2218.clinic-bubbleprof/
C:\Users\olivi\AppData\Roaming\npm\node_modules\clinic\node_modules\@nearform\bubbleprof\analysis\aggregate\mark-module
-aggregate-nodes.js:21
      aggregateNode.mark.set(1, firstModule.name)
                                            ^

TypeError: Cannot read property 'name' of undefined
    at MarkModuleAggregateNodes._transform (C:\Users\olivi\AppData\Roaming\npm\node_modules\clinic\node_modules\@nearfo
rm\bubbleprof\analysis\aggregate\mark-module-aggregate-nodes.js:21:45)
    at MarkModuleAggregateNodes.Transform._read (internal/streams/transform.js:205:10)
    at MarkModuleAggregateNodes.Transform._write (internal/streams/transform.js:193:12)
    at writeOrBuffer (internal/streams/writable.js:358:12)
    at MarkModuleAggregateNodes.Writable.write (internal/streams/writable.js:303:10)
    at MarkPartyAggregateNodes.ondata (internal/streams/readable.js:726:22)
    at MarkPartyAggregateNodes.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at MarkPartyAggregateNodes.Readable.push (internal/streams/readable.js:204:10)

I can confirm that when removing sqlite from my code, this isn't showing up anymore.