node-proxy
node-proxy copied to clipboard
Segmentation fault (core dumped) on node v0.6.x
The code below crashes sometimes with segmentation error. I tested it on node 0.6.6( crashes ) and 0.4.12 ( works ) Look to get in the handler, other traps are default.
var Proxy = require( 'node-proxy' );
function ProxyHandler( target ) {
return {
getOwnPropertyDescriptor : function( name ) {
var desc = Object.getOwnPropertyDescriptor( target, name );
if ( desc !== undefined ) {
desc.configurable = true;
}
return desc;
},
getPropertyDescriptor : function( name ) {
var desc = Object.getOwnPropertyDescriptor( target, name );
var parent = Object.getPrototypeOf( target );
while ( desc === undefined && parent !== null ) {
desc = Object.getOwnPropertyDescriptor( parent, name );
parent = Object.getPrototypeOf( parent );
}
if ( desc !== undefined ) {
desc.configurable = true;
}
return desc;
},
getOwnPropertyNames : function() {
return Object.getOwnPropertyNames( target );
},
getPropertyNames : function() {
var props = Object.getOwnPropertyNames( target );
var parent = Object.getPrototypeOf( target );
while ( parent !== null ) {
props = props.concat( Object.getOwnPropertyNames( parent ) );
parent = Object.getPrototypeOf( parent );
}
return props;
},
defineProperty : function( name, desc ) {
return Object.defineProperty( target, name, desc );
},
'delete' : function( name ) {
return delete target[ name ];
},
fix : function() {
if ( !Object.isFrozen( target ) ) return undefined;
var props = {};
for ( var name in target ) {
props[ name ] = Object.getOwnPropertyDescriptor( target, name );
}
return props;
},
has : function( name ) {
return name in target;
},
hasOwn : function( name ) {
return ({}).hasOwnProperty.call( target, name );
},
get : function( receiver, name ) {
var super_prototype = Object.getPrototypeOf( Object.getPrototypeOf( Object.getPrototypeOf( target ) ));
return super_prototype[ name ].bind( target );
},
set : function( receiver, name, val ) {
target[ name ] = val;
return true;
},
enumerate : function() {
var result = [];
for ( var name in target ) {
result.push( name );
}
return result;
},
iterate : function() {
var props = this.enumerate();
var i = 0;
return {
next: function() {
if ( i === props.length ) throw StopIteration;
return props[i++];
}
};
},
keys : function() {
return Object.keys( target );
}
}
}
function ClassA() {}
ClassA.prototype.method = function() {};
require('util').inherits( ClassB, ClassA );
function ClassB() {}
ClassB.prototype.method = function() {
var handler = ProxyHandler( this );
var s = Proxy.create( handler, Object.getPrototypeOf( this ) );
s.method();
};
var j = 0;
require('util').inherits( ClassC, ClassB );
function ClassC() {
console.log( j++ );
this.method();
}
for( var i = 0; i < 50; i++ ) new ClassC;
console.log( 'All good' );
My output ( count of numbers is always different ):
$ node index.js
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Erreur de segmentation (core dumped)
it does make error mesage on node make server and on npm install
module.js:340
throw err;
^
Error: Cannot find module '../build/Release/nodeproxy.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.
on npm install throws the following error
[email protected] install /usr/lib/node_modules/butter/node_modules/client-sess ions/node_modules/node-proxy node-gyp configure build
npm http GET https://registry.npmjs.org/hashish/0.0.4
make: Entering directory /usr/lib/node_modules/butter/node_modules/sqlite3/buil d' CC(target) Debug/obj.target/sqlite3/deps/sqlite3/sqlite3.o npm http 304 https://registry.npmjs.org/burrito/0.2.12 npm http 304 https://registry.npmjs.org/eyes/0.1.8 npm http 304 https://registry.npmjs.org/diff/1.0.3 ../deps/sqlite3/sqlite3.c: In function âposixUnlockâ: ../deps/sqlite3/sqlite3.c:26153:7: warning: variable âhâ set but not used [-Wunu sed-but-set-variable] ../deps/sqlite3/sqlite3.c: In function âsqlite3RefillIndexâ: ../deps/sqlite3/sqlite3.c:81465:7: warning: variable âregIdxKeyâ set but not use d [-Wunused-but-set-variable] ../deps/sqlite3/sqlite3.c: In function âsqlite3CommitTransactionâ: ../deps/sqlite3/sqlite3.c:82550:12: warning: variable âdbâ set but not used [-Wu nused-but-set-variable] ../deps/sqlite3/sqlite3.c: In function âsqlite3RollbackTransactionâ: ../deps/sqlite3/sqlite3.c:82570:12: warning: variable âdbâ set but not used [-Wu nused-but-set-variable] npm http 304 https://registry.npmjs.org/hashish/0.0.4 ../deps/sqlite3/sqlite3.c: In function âsqlite3Parserâ: ../deps/sqlite3/sqlite3.c:108822:7: warning: variable âyyendofinputâ set but not used [-Wunused-but-set-variable] ../deps/sqlite3/sqlite3.c: In function âporter_stemmerâ: ../deps/sqlite3/sqlite3.c:121289:41: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121293:39: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121306:35: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121311:39: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121317:41: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121322:39: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121331:38: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121338:37: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121381:39: warning: value computed is not used [-Wunus ed-value] ../deps/sqlite3/sqlite3.c:121401:34: warning: value computed is not used [-Wunus ed-value] npm http GET https://registry.npmjs.org/uglify-js/1.1.1 ../deps/sqlite3/sqlite3.c: In function âChooseLeafâ: ../deps/sqlite3/sqlite3.c:128597:11: warning: variable âfMinOverlapâ set but not used [-Wunused-but-set-variable] npm http GET https://registry.npmjs.org/traverse/0.5.2 npm http GET https://registry.npmjs.org/traverse/0.6.3 make: Entering directory
/usr/lib/node_modules/butter/node_modules/client-sessi ons/node_modules/node-proxy/build'
CXX(target) Debug/obj.target/nodeproxy/src/node-proxy.o
npm http 304 https://registry.npmjs.org/uglify-js/1.1.1
npm http 304 https://registry.npmjs.org/traverse/0.5.2
npm http 304 https://registry.npmjs.org/traverse/0.6.3
../src/node-proxy.cc: In static member function âstatic v8::Handlev8::Value v8 ::NodeProxy::GetNamedProperty(v8::Localv8::String, const v8::AccessorInfo&)â:
../src/node-proxy.cc:816:1: warning: control reaches end of non-void function [- Wreturn-type]
SOLINK_MODULE(target) Debug/obj.target/nodeproxy.node
SOLINK_MODULE(target) Debug/obj.target/nodeproxy.node: Finished
COPY Debug/nodeproxy.node
make: Leaving directory /usr/lib/node_modules/butter/node_modules/client-sessio ns/node_modules/node-proxy/build' AR(target) Debug/obj.target/deps/sqlite3/sqlite3.node CXX(target) Debug/obj.target/node_sqlite3/src/database.o CXX(target) Debug/obj.target/node_sqlite3/src/node_sqlite3.o CXX(target) Debug/obj.target/node_sqlite3/src/statement.o SOLINK_MODULE(target) Debug/obj.target/node_sqlite3.node SOLINK_MODULE(target) Debug/obj.target/node_sqlite3.node: Finished COPY Debug/node_sqlite3.node make: Leaving directory
/usr/lib/node_modules/butter/node_modules/sqlite3/build '
[email protected] /usr/lib/node_modules/butter
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected]
âââ [email protected] ([email protected])
âââ [email protected] ([email protected])
âââ [email protected] ([email protected], [email protected])
âââ [email protected] ([email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected])
âââ [email protected] ([email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], validator @0.3.9, [email protected], [email protected], [email protected], [email protected])
âââ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
âââ [email protected] ([email protected], [email protected])
âââ [email protected]