soyuka / pidusage

Cross-platform process cpu % and memory usage of a PID
MIT License
512 stars 55 forks source link

Cannot read property 'memory' of null #28

Closed starsoccer closed 8 years ago

starsoccer commented 8 years ago

I recently installed Express-status-monitor which seems to make use of pidusage and it is causing an error. The status page seems to function fine, but my nodejs app will randomly crash with the following error,

TypeError: Cannot read property 'memory' of null at \node_modules\express-status-monitor\index.js line 43 col 25) at ChildProcess. (\node_modules\pidusage\lib\stats.js line 151 col 16) at emitTwo (events.js line 100 col 13) at ChildProcess.emit (events.js line 185 col 7) at maybeClose (internal/child_process.js line 827 col 16) at Process.__dirname.ChildProcess._handle.onexit (internal/child_process.js line 211 col 5)

soyuka commented 8 years ago

This is due to the fact that they don't catch the error if any.

L151 here means:

  1. you're using windows
  2. The pid used for memory usage has not been found by wmic

This has to be fixed on express-status-monitor https://github.com/RafalWilinski/express-status-monitor/issues/35.