Skip to content

native bindings seg faulting with node v0.7.12 #136

Closed
@muirmanders

Description

@muirmanders

I am seeing segmentation faults when trying to use the native pg bindings with node v0.7.12 (pg v0.7.1, postgres 9, Mac OS X 10.7.3).

I do not see the problem using the javascript bindings, and I do not see the problem on node v0.6.19 with native or javascript bindings.

Here is a simple script which produces a seg fault for me:

var pg = require('pg').native;

var client = new pg.Client('postgres://muir@localhost/node_test');
client.connect();

client.query('select 1', function(err, data) {
  console.log("didn't segfault!");
  process.exit();
});

Here is some debugging info from gdb (notice that "loop" is null for some reason):

Reading symbols for shared libraries ..... done
WARNING: ev_io is deprecated, use uv_poll_t

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000000000a0
uv__io_stop (loop=0x0, handle=0x102800110) at ../deps/uv/src/unix/core.c:636
636   ev_io_stop(loop->ev, &handle->io_watcher);
(gdb) thread apply all bt

Thread 2 (process 73678):
#0  0x00007fff883106b6 in semaphore_wait_trap ()
#1  0x00000001002da71d in v8::internal::RuntimeProfiler::WaitForSomeIsolateToEnterJS () at /Users/muir/.nvm/src/node-v0.7.12/deps/v8/src/runtime-profiler.cc:443
#2  0x00000001002da71d in v8::internal::RuntimeProfilerRateLimiter::SuspendIfNecessary (this=0x1a03) at runtime-profiler.cc:490
#3  0x0000000100397dab in v8::internal::SamplerThread::Run (this=0x1a03) at platform-macos.cc:781
#4  0x00000001003970ad in ThreadEntry (arg=0x100b18310) at platform-macos.cc:518
#5  0x00007fff879828bf in _pthread_start ()
#6  0x00007fff87985b75 in thread_start ()
Current language:  auto; currently c

Thread 1 (process 73678):
#0  uv__io_stop (loop=0x0, handle=0x102800110) at ../deps/uv/src/unix/core.c:636
#1  0x0000000100050110 in uv__handle_stop [inlined] () at /Users/muir/.nvm/src/node-v0.7.12/deps/uv/src/uv-common.h:74
#2  0x0000000100050110 in uv__poll_stop [inlined] () at /Users/muir/.nvm/src/node-v0.7.12/deps/uv/src/unix/poll.c:75
#3  0x0000000100050110 in uv_poll_stop (handle=0x1028000c0) at ../deps/uv/src/unix/poll.c:81
#4  0x0000000100aa9047 in Connection::HandleConnectionIO (this=0x102800090) at binding.cc:589
#5  0x0000000100aa954b in Connection::HandleIOEvent (this=0x102800090, revents=1606415184) at binding.cc:391
#6  0x00000001000485e3 in ev_invoke_pending (loop=0x10066f8c0) at ../deps/uv/src/unix/ev/ev.c:2145
#7  0x0000000100044739 in uv__run (loop=0x10066f260) at ../deps/uv/src/unix/core.c:248
#8  0x00000001000448dc in uv_run (loop=0x10066f260) at ../deps/uv/src/unix/core.c:265
#9  0x0000000100008025 in node::Start (argc=1606415456, argv=0x100aa9001) at node.cc:2885
#10 0x0000000100001384 in start ()

Could the problem just be that pg needs to be updated to use uv instead of ev?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions