On 11/13/2012 08:05 AM, Mohd. Bilal Husain wrote:
I was writing a tcp client which reads from a socket and somehow the libuv `on_tcp_read_cb` was getting called with nread = -1 and the program was terminating with segmentation fault immediately after processing this incoming error/eof; which I could somewhat fix using the different signature of `on_alloc_cb`

extern fn on_alloc_cb(&out_buf: uv::ll::uv_buf_t, handle: *libc::c_void, suggested_size: libc::size_t) -> uv::ll::uv_buf_t unsafe

as opposed to the library signature

extern fn on_alloc_cb(handle: *libc::c_void, suggested_size: libc::size_t) -> uv::ll::uv_buf_t unsafe

The client has nread > 0 and I am able to read the data but the program segfaults shortly after that step.

What am I doing wrong? Has anyone faced a similar issue. What sort of debugging information can I provide?
Thanks for your help :)


The first thing I always ask when somebody has uv problems is, 'is this on 32-bit x86?'. The issue you describe sounds like it could be a symptom of https://github.com/mozilla/rust/issues/2064, in which rustc fails to use the x86 ABI correctly when calling into C.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to