h0x91b / redis-fast-driver

78 stars 13 forks source link

Segmentation Fault 11 #29

Closed sirganya closed 4 years ago

sirganya commented 4 years ago

When I run the async version of the driver in jest tests I eventually get segmentation fault 11 followed on the next run by

FATAL ERROR: v8::Function::Call Function to be called is a null pointer 1: 0x10007767f node::Abort() [/usr/local/bin/node] 2: 0x100077803 node::OnFatalError(char const*, char const*) [/usr/local/bin/node] 3: 0x10018c177 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/usr/local/bin/node] 4: 0x102b5fbf8 RedisConnector::OnRedisResponse(redisAsyncContext*, void*, void*) [/Users/gregkavanagh/git/newting/node_modules/redis-fast-driver/build/Release/redis-fast-driver.node] 5: 0x102b662e6 redisProcessCallbacks [/Users/gregkavanagh/git/newting/node_modules/redis-fast-driver/build/Release/redis-fast-driver.node] 6: 0x102b601da redisLibuvPoll(uv_poll_s*, int, int) [/Users/gregkavanagh/git/newting/node_modules/redis-fast-driver/build/Release/redis-fast-driver.node] 7: 0x10087ce3d uv__io_poll [/usr/local/bin/node] 8: 0x10086cd66 uv_run [/usr/local/bin/node] 9: 0x1000ada88 node::NodeMainInstance::Run() [/usr/local/bin/node] 10: 0x1000576ac node::Start(int, char**) [/usr/local/bin/node] 11: 0x7fff66a853d5 start [/usr/lib/system/libdyld.dylib] Abort trap: 6

I was wondering if I'm failing to clean up after the tests correctly?

h0x91b commented 4 years ago

Didn’t checked tests for a while, maybe something have been broken. I’ll check.

On 22 Oct 2019, at 21:51, Greg Kavanagh notifications@github.com wrote:

When I run the async version of the driver in jest tests I eventually get segmentation fault 11 followed on the next run by

FATAL ERROR: v8::Function::Call Function to be called is a null pointer 1: 0x10007767f node::Abort() [/usr/local/bin/node] 2: 0x100077803 node::OnFatalError(char const, char const) [/usr/local/bin/node] 3: 0x10018c177 v8::Function::Call(v8::Local, v8::Local, int, v8::Local) [/usr/local/bin/node] 4: 0x102b5fbf8 RedisConnector::OnRedisResponse(redisAsyncContext, void, void) [/Users/gregkavanagh/git/newting/node_modules/redis-fast-driver/build/Release/redis-fast-driver.node] 5: 0x102b662e6 redisProcessCallbacks [/Users/gregkavanagh/git/newting/node_modules/redis-fast-driver/build/Release/redis-fast-driver.node] 6: 0x102b601da redisLibuvPoll(uv_poll_s*, int, int) [/Users/gregkavanagh/git/newting/node_modules/redis-fast-driver/build/Release/redis-fast-driver.node] 7: 0x10087ce3d uv__io_poll [/usr/local/bin/node] 8: 0x10086cd66 uv_run [/usr/local/bin/node] 9: 0x1000ada88 node::NodeMainInstance::Run() [/usr/local/bin/node] 10: 0x1000576ac node::Start(int, char**) [/usr/local/bin/node] 11: 0x7fff66a853d5 start [/usr/lib/system/libdyld.dylib] Abort trap: 6

I was wondering if I'm failing to clean up after the tests correctly?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/h0x91b/redis-fast-driver/issues/29?email_source=notifications&email_token=AAGFYG33B6HJKF3FGWNK5LTQP5DUFA5CNFSM4JDT3ESKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HTS23BA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGFYGYX7EVE2OBY2FQWC5DQP5DUFANCNFSM4JDT3ESA.

sirganya commented 4 years ago

Sorry, I wan't clear. I'm using it in my own tests using Jest to run them. I'm using afterAll() to trigger redis.end(). When I remove that the tests run. Is not calling redis.end() a problem?

h0x91b commented 4 years ago

Hi, the problem is in setImmediate function, it's null for some reason, probably Jest overwrites it, please make sure that setImmediate function exists before you making new Redis instance...

You can overwrite it by your own, something like

function setImmediate(fn, ...args) {
  return fn(...args);
}

Reference:

https://github.com/h0x91b/redis-fast-driver/blob/master/src/redis-fast-driver.cc#L128 https://github.com/h0x91b/redis-fast-driver/blob/master/src/redis-fast-driver.cc#L203

sirganya commented 4 years ago

Ok. Thanks.