Doesn't work under node-0.5.4 ("Local scope has already been closed") #12

Closed
natevw opened this Issue Aug 25, 2011 · 10 comments

Comments

Projects
None yet
3 participants

natevw commented Aug 25, 2011

After fixing the test to use require("../lib/node-proxy") instead of the require.paths.unshift call, the tests still fail under node-0.5.4:

$ /tmp/node-v0.5.4/node node-proxy/test/test.js 
FATAL ERROR: v8::HandleScope::Close() Local scope has already been closed
Owner

samshull commented Aug 26, 2011

No guarantee that you will be able to get it working in 0.5.*, because of API changes, but try adding process.env['NODE_PATH'] += ':' + __dirname + "/../lib"; to the test.js file.

natevw commented Aug 26, 2011

Still get the same internal V8 assertion error. I don't think it's related at all to paths, sorry for bringing that into the ticket if it caused confusion. The bug I am seeing is (with both the test suite and my own library that uses node-proxy) is that it crashes on a V8 call:

FATAL ERROR: v8::HandleScope::Close() Local scope has already been closed
Owner

samshull commented Aug 31, 2011

Apply this diff and let me know what the build results are, please.

natevw commented Aug 31, 2011

It builds fine:

BUILDING: C++ Component
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : ok /usr/local/lib/node 
Checking for node prefix                 : ok /usr/local/Cellar/node/0.4.11 
'configure' finished successfully (0.032s)
Waf: Entering directory `/Users/nathan/Development/Others'/node-proxy/src/build'
[1/2] cxx: node-proxy.cc -> build/default/node-proxy_1.o
[2/2] cxx_link: build/default/node-proxy_1.o -> build/default/node-proxy.node
Waf: Leaving directory `/Users/nathan/Development/Others'/node-proxy/src/build'
'build' finished successfully (0.449s)

but (now testing with node-0.5.5), it segfaults halfway through the tests:

node-proxy nathan$ /tmp/node-v0.5.5/node test/test.js
Running tests...


1: Base Proxy methods
  Proxy.create: PASS
  Proxy.createFunction: PASS
  Proxy.createFunction with optional constructor trap: PASS
  Proxy.isTrapping on proxy object: PASS

2: Testing proxy function instance
  proxy function is callable: PASS
  proxy function has accessible properties: PASS
  proxy function get properties: PASS
  proxy function as constructor: PASS
  proxy function instance property handling: PASS

3: Testing proxy object instance
  has property 'first': PASS
  get property 'first': PASS
  set property 'first' to new value: PASS
  set new property 'second': PASS
  has new property 'second': PASS
  get newly set property 'second': PASS
  iterate property names: PASS
  Object.getOwnPropertyNames on proxy object: PASS
  Object.getOwnPropertyNames returned an Array: PASS
  Object.getOwnPropertyNames return value has the correct length: PASS
  Object.getOwnPropertyNames has the correct values: PASS
  Object.keys on proxy object: PASS
  Object.keys returned an Array: PASS
  Object.keys return value has the correct length: PASS
  Object.keys has the correct values: PASS
  delete 'second': PASS
  proxy instance no longer has property 'second': PASS

4: Fundamental traps
  PropertyDescriptor context for get should be the receiver: PASS
  PropertyDescriptor context for set should be the receiver: PASS
  PropertyDescriptor should get value if get method is not supplied: PASS
  PropertyDescriptor should set value if set method is not supplied: PASS

5: Derived traps
  proxy context should be the PropertyHandler for derived trap 'get': PASS
  proxy context should be the PropertyHandler for derived trap 'has': PASS
  proxy context should be the PropertyHandler for derived trap 'enumerate': PASS
  proxy context should be the PropertyHandler for derived trap 'set': PASS

6: ECMAScript 5 implementation methods
  Proxy.defineProperty on proxy object: PASS
  proxy has newly defined property: PASS
  proxy's newly defined property have correct return value: PASS
  proxy's newly defined property are reflected in underlying handlers: PASS
  Proxy.defineProperties on proxy object: Segmentation fault: 11
Owner

samshull commented Sep 4, 2011

I have been unable to reproduce this error on OSX 10.6 and Ubuntu 11.04. Can you provide more detail about your system configuration?

natevw commented Sep 7, 2011

On Mac OS X 10.7.1 I can reproduce the segfault as follows:

cd /tmp
curl -O http://nodejs.org/dist/v0.5.5/node-v0.5.5.tar.gz
tar -xf node-v0.5.5.tar.gz
cd node-v0.5.5
./configure
make

cd /tmp
git clone https://github.com/samshull/node-proxy.git
cd node-proxy
curl -O https://raw.github.com/gist/1182721/7b6f712bd5713bd7e3d728192bcb3b8099edf791/remove_scope_close.diff
echo >> remove_scope_close.diff
git apply remove_scope_close.diff
make

# had to force correct library to be tested
curl -O https://raw.github.com/gist/1201562/453250bb6ed344881615b4f1d6a1cd51542af2f9/test_local_build.diff
git apply test_local_build.diff
/tmp/node-v0.5.5/node test/test.js

The actual crash looks like:

[...]
6: ECMAScript 5 implementation methods
  Proxy.defineProperty on proxy object: PASS
  proxy has newly defined property: PASS
  proxy's newly defined property have correct return value: PASS
  proxy's newly defined property are reflected in underlying handlers: PASS
  Proxy.defineProperties on proxy object: Segmentation fault: 11

So your first patch makes definite progress, but something's still causing trouble.

natevw commented Sep 7, 2011

I should note that your patch does allow my little test suite for https://github.com/andyet/fermata to all pass successfully under node v0.5.5 — thanks much! Can your patch be applied to the npm version of node-proxy? The patch seems to be working fine under node v0.4.11 too, and only the weird segfault (perhaps not your lib's fault?) under v0.5.5.

Owner

samshull commented Sep 10, 2011

Hmmm...I did exactly what you had in your example, except I didn't do git apply remove_scope_close.diff and I did not have the same problem that you had. But I would like to point out that calling make in the node-proxy directory would actually cause node-proxy to be compiled with /usr/local/bin/node-waf instead of ../node-v0.5.5/tools/node-waf, the node-waf version that came with node-v0.5.5 that you downloaded. If these 2 versions are not compatible, it could cause errors.

I find it useful to clean up all the old cruft from time to time. From in your node repo directory:


make distclean
git clean -dfx
rm `which node-waf`
rm `which node`
rm -rf /usr/local/include/node
rm -rf /usr/local/lib/node

Then do a clean install of node.

*Of course it could be useful to backup those files and folders in case you want to roll back.

boopathi commented Jan 2, 2012

samshull,
I'm using arch linux. And I get the same error. I tried re-installing nodejs . It did not work.

I used pacman to reinstall nodejs.

Owner

samshull commented Mar 6, 2012

@boopathi,
Sorry for the late reply. Did you perform the full cleanup shown in the comment?

@samshull samshull closed this May 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment