[gnet-devel] Problem with gnet_conn_disconnect()
- From: "Rui Coelho" <rui coelho gmail com>
- To: <gnet-devel-list gnome org>
- Subject: [gnet-devel] Problem with gnet_conn_disconnect()
- Date: Thu, 20 Mar 2008 20:10:25 -0000
Hi,
I'm using libgnet for the first time and I've run into an annoying problem.
Here's the scenario:
As the client thread connected is blocked in a gnet_io_channel_read()
waiting for incoming data, I SIGINT the server triggering a G_IO_ERROR_* to
the client. This behaviour seems correct to me, but when I try to close the
connection
with this code:
if (gnet_conn_is_connected (connection))
{
g_debug ("Connection is still open");
gnet_conn_disconnect (connection);
}
When gnet_conn_disconnect () is called the program crashes:
** (process:30154): DEBUG: Connection is still open
*** glibc detected *** /home/rui/Projects/grabthat/src/.libs/lt-grabthat:
malloc(): memory corruption: 0xb7ebc177 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7dde384]
/lib/libc.so.6(__libc_malloc+0x8d)[0xb7ddfced]
/lib/libc.so.6(vasprintf+0x23)[0xb7dd4813]
/usr/lib/libglib-2.0.so.0(g_vasprintf+0x37)[0xb7f36557]
/usr/lib/libglib-2.0.so.0(g_strdup_vprintf+0x26)[0xb7f27546]
/usr/lib/libglib-2.0.so.0(g_logv+0x1b7)[0xb7f0fd67]
/usr/lib/libglib-2.0.so.0(g_log+0x29)[0xb7f0ffd9]
/home/rui/Projects/grabthat/src/nntp/.libs/libnntp.so.0(_nntp_end+0xaa)[0xb7ed680a]
/home/rui/Projects/grabthat/src/nntp/.libs/libnntp.so.0(nntp_list+0x3b)[0xb7ed6aeb]
/usr/lib/libgnet-2.0.so.0[0xb7f8f419]
/usr/lib/libgnet-2.0.so.0(gnet_tcp_socket_new_async_cb+0xc0)[0xb7f86160]
/usr/lib/libglib-2.0.so.0[0xb7f3692d]
/usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x176)[0xb7f072b6]
/usr/lib/libglib-2.0.so.0[0xb7f0a643]
/usr/lib/libglib-2.0.so.0(g_main_loop_run+0x1e7)[0xb7f0aa27]
/home/rui/Projects/grabthat/src/.libs/lt-grabthat[0x80490f5]
/lib/libc.so.6(__libc_start_main+0xe0)[0xb7d88450]
/home/rui/Projects/grabthat/src/.libs/lt-grabthat[0x8048b71]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 03:02 407702
/home/rui/Projects/grabthat/src/.libs/lt-grabthat
0804a000-0804b000 rw-p 00001000 03:02 407702
/home/rui/Projects/grabthat/src/.libs/lt-grabthat
0804b000-0806e000 rw-p 0804b000 00:00 0 [heap]
b6b00000-b6b21000 rw-p b6b00000 00:00 0
b6b21000-b6c00000 ---p b6b21000 00:00 0
b6ce6000-b6cf2000 r-xp 00000000 03:02 144471 /lib/libgcc_s.so.1
b6cf2000-b6cf3000 rw-p 0000b000 03:02 144471 /lib/libgcc_s.so.1
b6cf3000-b6cfc000 r-xp 00000000 03:02 145487 /lib/libnss_files-2.7.so
b6cfc000-b6cfe000 rw-p 00008000 03:02 145487 /lib/libnss_files-2.7.so
b6d14000-b6d15000 ---p b6d14000 00:00 0
b6d15000-b7514000 rw-p b6d15000 00:00 0
b7514000-b7515000 ---p b7514000 00:00 0
b7515000-b7d16000 rw-p b7515000 00:00 0
b7d16000-b7d3c000 r-xp 00000000 03:02 195008 /usr/lib/libpcre.so.3.12.1
b7d3c000-b7d3d000 rw-p 00025000 03:02 195008 /usr/lib/libpcre.so.3.12.1
b7d3d000-b7d44000 r-xp 00000000 03:02 145494 /lib/librt-2.7.so
b7d44000-b7d46000 rw-p 00006000 03:02 145494 /lib/librt-2.7.so
b7d46000-b7d5a000 r-xp 00000000 03:02 145484 /lib/libnsl-2.7.so
b7d5a000-b7d5c000 rw-p 00013000 03:02 145484 /lib/libnsl-2.7.so
b7d5c000-b7d5e000 rw-p b7d5c000 00:00 0
b7d5e000-b7d6d000 r-xp 00000000 03:02 145493 /lib/libresolv-2.7.so
b7d6d000-b7d6f000 rw-p 0000f000 03:02 145493 /lib/libresolv-2.7.so
b7d6f000-b7d72000 rw-p b7d6f000 00:00 0
b7d72000-b7eb9000 r-xp 00000000 03:02 145478 /lib/libc-2.7.so
b7eb9000-b7eba000 r--p 00147000 03:02 145478 /lib/libc-2.7.so
b7eba000-b7ebc000 rw-p 00148000 03:02 145478 /lib/libc-2.7.so
b7ebc000-b7ebf000 rw-p b7ebc000 00:00 0
b7ebf000-b7ed2000 r-xp 00000000 03:02 145492 /lib/libpthread-2.7.so
b7ed2000-b7ed4000 rw-p 00013000 03:02 145492 /lib/libpthread-2.7.so
b7ed4000-b7ed6000 rw-p b7ed4000 00:00 0
b7ed6000-b7ed7000 r-xp 00000000 03:02 246314
/home/rui/Projects/grabthat/src/nntp/.libs/libnntp.so.0.0.0
b7ed7000-b7ed8000 rw-p 00001000 03:02 246314
/home/rui/Projects/grabthat/src/nntp/.libs/libnntp.so.0.0.0
b7ed8000-b7f78000 r-xp 00000000 03:02 200525
/usr/lib/libglib-2.0.so.0.1400.6
b7f78000-b7f79000 rw-p 0009f000 03:02 200525
/usr/lib/libglib-2.0.so.0.1400.6
b7f79000-b7f7c000 r-xp 00000000 03:02 200522
/usr/lib/libgthread-2.0.so.0.1400.6
b7f7c000-b7f7d000 rw-p 00003000 03:02 200522
/usr/lib/libgthread-2.0.so.0.1400.6
b7f7d000-b7f97000 r-xp 00000000 03:02 453059
/usr/lib/libgnet-2.0.so.0.6.1
b7f97000-b7f98000 rw-p 0001a000 03:02 453059
/usr/lib/libgnet-2.0.so.0.6.1
b7f98000-b7f99000 rw-p b7f98000 00:00 0
b7fa7000-b7fae000 r--s 00000000 03:02 198620
/usr/lib/gconv/gconv-modules.cache
b7fae000-b7fb0000 rw-p b7fae000 00:00 0
b7fb0000-b7fcc000 r-xp 00000000 03:02 145475 /lib/ld-2.7.so
b7fcc000-b7fce000 rw-p 0001b000 03:02 145475 /lib/ld-2.7.so
bf8b7000-bf8cc000 rw-p bf8b7000 00:00 0 [stack]
ffffe000-fffff000 ---p 00000000 00:00 0 [vdso]
Aborted
strace output:
write(1, "** (process:30174): DEBUG: Conne"..., 52** (process:30174): DEBUG:
Connection is still open
) = 52
close(5) = 0
open("/dev/tty", O_RDWR|O_NONBLOCK|O_NOCTTY) = 5
writev(5, [{"*** glibc detected *** ", 23},
{"/home/rui/Projects/grabthat/src/"..., 49}, {": ", 2}, {"malloc(): memory
corruption", 27}, {": 0x", 4}, {"b7e6e177", 8}, {" ***\n", 5}], 7*** glibc
detected *** /home/rui/Projects/grabthat/src/.libs/lt-grabthat: malloc():
memory corruption: 0xb7e6e177 ***
) = 118
....
Am I doing something wrong? Shouldn't I call gnet_conn_is_connected () and
then gnet_conn_disconnect () ?
PS: sorry for my english
--
Rui Martins
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]