|
From: Subredu M. <di...@ia...> - 2004-01-20 19:56:17
|
Hi,
I'm have some troubles with libdbi + mysql . I have a C program for
detecting floods. When the program starts, his open a connection to a mysql
database (on another machine) take some data from there, and leaves the
connection opened. After some time (>6 hours) when the program needs to
interogate the database, it crashes. I've run the program inside a gdb. This
is the output of a bt command in gdb
Program received signal SIGPIPE, Broken pipe.
0x420d6fd8 in write () from /lib/i686/libc.so.6
(gdb) bt
#0 0x420d6fd8 in write () from /lib/i686/libc.so.6
#1 0x40200c3c in _db_process_ () from /usr/lib/mysql/libmysqlclient.so.10
#2 0x401d76da in net_real_write () from /usr/lib/mysql/libmysqlclient.so.10
#3 0x401d73e8 in net_flush () from /usr/lib/mysql/libmysqlclient.so.10
#4 0x401d7586 in net_write_command () from /usr/lib/mysql/libmysqlclient.s=
o.10
#5 0x401d3814 in simple_command () from /usr/lib/mysql/libmysqlclient.so.10
#6 0x401d5c50 in mysql_real_query () from /usr/lib/mysql/libmysqlclient.so=
.10
#7 0x401d59e5 in mysql_query () from /usr/lib/mysql/libmysqlclient.so.10
#8 0x4001da0b in dbd_query () from /usr/lib/dbd/libmysql.so
#9 0x4002424e in dbi_conn_query () from /usr/lib/libdbi.so.0
#10 0x08052960 in query (q=3D0xbfffa7c0 "select * from tbl_filtre where f_i=
p_src=3D'192.168.0.1' and f_ip_dst=3D'0.0.0.0' and f_end_time > 1074514239"=
, want_result=3D1)
at database.c:127
#11 0x0804cade in oldFilterExists (response=3D0x4005c4e0) at zazu.c:1683
#12 0x0804d95f in mail_flow (response=3D0x4005c4e0) at zazu.c:2022
#13 0x0804f70c in analyze (header_buff=3D0xbfffb0a0 "", flow_buff=3D0xbfffb=
0b8 "\23\006\213\2273\204\214=D9I=A0E") at zazu.c:2746
#14 0x0804f81c in display_nfe (buff=3D0xbfffb0a0 "", buff_len=3D1464) at za=
zu.c:2814
#15 0x080505e3 in main (argc=3D4, argv=3D0xbffff104) at zazu.c:3290
#16 0x42015967 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) select-frame 10
(gdb) list 127
122 dbi_result result;
123
124 if ( conn =3D=3D NULL )
125 return NULL;
126
127 result =3D dbi_conn_query(conn,q);
128
129 if ( result =3D=3D NULL)
130 {
131 return NULL;
(gdb) print conn
$1 =3D 0x809eb88
(gdb) print result
$2 =3D (void *) 0x40013020
The versions are:
RedHat 8.0 (updated)
libdbi-drivers-dbd-pgsql-0.7.1-1
libdbi-devel-0.7.2-1
libdbi-drivers-dbd-mysql-0.7.1-1
libdbi-0.7.2-1
mysql-devel-3.23.58-1.80
mysql-3.23.58-1.80
mysql-server-3.23.58-1.80
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
Linux some.com 2.4.20-18.8 #1 Thu May 29 08:57:39 EDT 2003 i686 i686 i386 G=
NU/Linux
is this a libdbi problem or a mysql problem ? As far as I can tell, it
happens like this:
* program opens connection to mysql server and leaves it open
* mysql server is timeout -ing and closing the connection
* program needs to query mysql server using already opened connection
* libdbi tryies to write to the connection he knew is opened and a SIGPIPE
is raised.
* nobody's happy :(
Can you give me a solution with this one ? Besides modifications in the
program to open/close connections.=20
PS: Please include me in Cc when reply, because I'm not subscribed to the
list
=20
many thanks in advance.
--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
inf. Manuel SUBREDU
Network Engineer at RoEduNet Iasi
Phone: +40 (232) 201003
+40 (742) 088067
Email: di...@ia...
website: http://manuel.iasi.roedu.net
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D |