indutny / candor

Experimental VM for a `Candor` language
http://candor-lang.org/
177 stars 16 forks source link

When GC moves CData, it's internal pointer is moved too. #13

Closed creationix closed 12 years ago

creationix commented 12 years ago

In my tcp server, I get segfaults and/or libuv assert failures when I run it under high-enough load for the GC to move my CData instance. Here is a log of the output:

cdata: 0x7ffff6c755f3     // This is the address of the CData*
stream: 0x7ffff6c75602    // This is the address of the uv_stream_t*
cdata: 0x7ffff6c755f3
stream: 0x7ffff6c75602
cdata: 0x7ffff6c755f3
stream: 0x7ffff6c75602
cdata: 0x7ffff6470f37     // CData* moved
stream: 0x7ffff6470f46    // so did uv_stream_t*

Program received signal SIGSEGV, Segmentation fault.
0x000000000043e683 in uv_write2 (req=0x7c7280, stream=0x7ffff6470f46, bufs=0x780c30, bufcnt=1, send_handle=0x0, cb=0x40938f <luv_on_write(uv_write_t*, int)>) at src/unix/stream.c:904
904   ngx_queue_insert_tail(&stream->write_queue, &req->queue);
(gdb) bt
#0  0x000000000043e683 in uv_write2 (req=0x7c7280, stream=0x7ffff6470f46, bufs=0x780c30, bufcnt=1, send_handle=0x0, cb=0x40938f <luv_on_write(uv_write_t*, int)>) at src/unix/stream.c:904
#1  0x000000000043e80f in uv_write (req=0x7c7280, stream=0x7ffff6470f46, bufs=0x780c30, bufcnt=1, cb=0x40938f <luv_on_write(uv_write_t*, int)>) at src/unix/stream.c:937
#2  0x0000000000409518 in luv_write (argc=2, argv=...) at src/luv_stream.cc:139
#3  0x00007ffff7ff80b0 in ?? ()
#4  0x0000000000000001 in ?? ()
#5  0x0000000000000000 in ?? ()

Are the internal pointers for CData supposed to move when they do, and if so, is it forgetting to move the data as well?

indutny commented 12 years ago

This is not an issue, Candor doesn't have a non-moving GC (and won't have ever, I hope). So user should expect that his data that resides in the heap may move in any moment.