iriscouch / traceback

Easy access to the call stack, for Node.js
Apache License 2.0
44 stars 6 forks source link

Does not work with io.js 1.3 #5

Open robbieferrero opened 9 years ago

robbieferrero commented 9 years ago
/Users/rferrero/devel/tracetest/node_modules/traceback/lib/frame.js:25
  frame.type      = frame.getTypeName()
                          ^
TypeError: Cannot read property 'constructor' of undefined

I tried with the fork at: https://github.com/iriscouch/traceback/pull/2 and I get the error:

/Users/rferrero/devel/tracetest/node_modules/traceback/lib/frame.js:38
  frame.is_eval   = frame.isEval()
                          ^
illegal access
zamnuts commented 9 years ago

This is due to issue 3718 of the v8 project: https://code.google.com/p/v8/issues/detail?id=3718

The problem occurs when call_site.receiver is undefined or null, i.e. it does have a constructor.

var frame = Object.create(call_site)
if ( typeof call_site.receiver === 'undefined' || call_site.receiver === null ) {
  call_site.receiver = {};
}
frame.type      = frame.getTypeName()

Technically this issue should be resolved upstream; any work done in traceback would be a bandaid. I'd prefer the bandaid over waiting on another node.js maintenance release.

The issue is not isolated to io.js (I wasn't using io.js).

Vadorequest commented 9 years ago

I think I have the same error.

c:\wamp\www\Ayolan\Translation\node_modules\mongoose\node_modules\mpromise\lib\promise.js:108
  if (this.ended && !this.hasRejectListeners()) throw reason;
                                                      ^
TypeError: Cannot read property 'constructor' of undefined
    at CallSiteGetTypeName (native)
    at Object.make_easy [as make] (c:\wamp\www\Ayolan\Translation\node_modules\traceback\lib\frame.js:25:27)
    at c:\wamp\www\Ayolan\Translation\node_modules\traceback\traceback.js:38:54

It seem to fail on frame.type = frame.getTypeName() in frame.js:25.

If I understand correctly, this is a bug from node.js itself? So we need to wait for a fix from node?

zamnuts commented 9 years ago

@Vadorequest that is the same error, you are correct. The bug is from v8, we need to wait for a fix from v8, and then node.js to update their bundled v8 version. Again, there is still the workaround mentioned in previous.

siddo420 commented 9 years ago

I added the patch to lib/frame.js but it still throws same error

function make_easy(call_site) {
  var frame = Object.create(call_site)

  if( typeof call_site.receiver === 'undefined' || call_site.receiver === null ) {
    call_site.receiver = {};
  }

  frame.this      = frame.getThis()
  frame.type      = frame.getTypeName()
node_modules/traceback/lib/frame.js:30
  frame.type      = frame.getTypeName()
                          ^
TypeError: Cannot read property 'constructor' of undefined
    at CallSiteGetTypeName (native)

I am using iojs.

Vadorequest commented 9 years ago

Any news on this? Does the situation has changed?

It seems like the issue has been fixed, i have not checked since. What version of node aren't /are safe to be used?

rdzak commented 8 years ago

Getting the same error on node 5.1.1.

revington commented 8 years ago

Tests do not pass with node 4.2.6 (LTS) and 5.x, stable.