Thx @ Saúl
Your guess is right, I have resolved this issue by making write after 
write_callback have been called in strictly seqquential.


On Friday, January 9, 2015 at 5:30:02 PM UTC+8, Saúl Ibarra Corretgé wrote:
>
> Hi, 
>
> On 01/09/2015 05:38 AM, Ken Shin wrote: 
> > Hi. 
> > Can anybody figure out the possible reason why i caused the next error? 
> > 
>
> Any chance you are reusing the write request before the callback is 
> called? 
>
> Can you print the req structure? 
>
> > The program crash at: 
> > 
> > Program received signal SIGSEGV, Segmentation fault. 
> > uv__write (stream=0x675898) at src/unix/stream.c:828 
> > 828           size_t len = buf->len; 
> > 
> > 
> > backtrace output: 
> > 
> > (gdb) bt 
> > #0  uv__write (stream=0x675898) at src/unix/stream.c:828 
> > #1  0x000000000042b6e6 in uv__stream_io (loop=<value optimized out>, 
> > w=0x675920, events=<value optimized out>) at src/unix/stream.c:1229 
> > #2  0x00000000004262e3 in uv__run_pending (loop=0x642a20, 
> > mode=UV_RUN_DEFAULT) at src/unix/core.c:702 
> > #3  uv_run (loop=0x642a20, mode=UV_RUN_DEFAULT) at src/unix/core.c:315 
> > #4  0x000000000040a04b in server_run () at server.c:1273 
> > #5  0x0000000000404245 in main (argc=1, argv=0x7fffffffe448) at 
> nproxy.c:174 
> > 
> > (gdb) f 0 
> > #0  uv__write (stream=0x675898) at src/unix/stream.c:828 
> > 828           size_t len = buf->len; 
> > 
> > (gdb) p buf 
> > $8 = (uv_buf_t *) 0x10 
> > (gdb) p buf->len 
> > Cannot access memory at address 0x18 
> > 
> > (gdb) p *stream 
> > $10 = {data = 0x675880, loop = 0x642a20, type = UV_TCP, close_cb = 0, 
> > handle_queue = {0x6759b0, 0x6664f0}, reserved = {0xe8c93a4155c08e2a, 
> > 0x9e48a03bc96b2226, 0x286b377c4174719a, 0x30b8a716f31422af}, 
> > next_closing = 0x0, flags = 24932, 
> >   write_queue_size = 1380, alloc_cb = 0x4079ae <server_on_alloc_cb>, 
> > read_cb = 0x409603 <server_on_read_done>, connect_req = 0x0, 
> > shutdown_req = 0x0, io_watcher = {cb = 0x42b570 <uv__stream_io>, 
> > pending_queue = {0x675928, 0x675928}, watcher_queue = { 
> >       0x675938, 0x675938}, pevents = 5, events = 5, fd = 40}, 
> > write_queue = {0x675a80, 0x675a80}, write_completed_queue = {0x675968, 
> > 0x675968}, connection_cb = 0, delayed_error = 0, accepted_fd = -1, 
> > queued_fds = 0x0} 
> > 
> > 
> > And the follow is part of my associated uv_write code: 
> > 
> > ``` 
> > uv_buf_t buf; 
> > 
> > buf.base = (char *)data; 
> > buf.len = len; 
> > 
> > r = uv_write(&conn->write_req, (uv_stream_t *)&conn->handle, &buf, 1 , 
> > server_on_write_done); 
> > ``` 
> > 
> > Thanks 
> > 
> > 
> > kenshin 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "libuv" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to [email protected] <javascript:> 
> > <mailto:[email protected] <javascript:>>. 
> > To post to this group, send email to [email protected] 
> <javascript:> 
> > <mailto:[email protected] <javascript:>>. 
> > Visit this group at http://groups.google.com/group/libuv. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
> -- 
> Saúl Ibarra Corretgé 
> bettercallsaghul.com 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to