>Description:

This is a resend or actually a reformatted bug report since the first
one I sent out contained a error on my part (I incorrectly looked at
the mysql_query() return code although I should be looking at
mysql_errno(). Now that is fixed but the problem remains.

If the remote database should become unaccessible (network problems)
it will take mysql_query() 17,5 minutes to timeout. That is a very
long time (especially in the world of IRC) and it should be settable
with mysql_options(). There are some generic TCP options for sockets
that can be used or then the read() should be wrapped in a alarm()
and/or the socket should be made non blockable. Below I have still
included the strace from where things go wrong:

- write() succeeds although it hasn't really (network was filtered at
  that point)

- read() gets stuck for 17,5 minutes

20:33:21 fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
20:33:21 read(3, 0x8090d68, 8192)       = -1 EAGAIN (Resource temporarily unavailable)
20:33:21 fcntl64(3, F_SETFL, O_RDWR)    = 0
20:33:21 write(3, "H\0\0\0\3INSERT INTO oer_output VALU"..., 76) = 76
20:33:21 read(3,
20:33:21 read(3, 0x8090d68, 4)          = -1 ETIMEDOUT (Connection timed out)
20:50:55 shutdown(3, 2 /* send and receive */) = -1 ENOTCONN (Transport endpoint is 
not connected)
20:50:55 close(3)                       = 0

>How-To-Repeat:

Start your MySQL program, filter the connection between the remote
database and the server your program is running on.

>Fix:

Implement a timer for network reads/writes, make the socket non
blockable.

>Submitter-Id:  <submitter ID>
>Originator:    
>Organization:
EQU, programmer of oer+MySQL (a MySQL based IRC bot)
>MySQL support: [none | licence | email support | extended email support ]
>Synopsis:      mysql_query() oddities if remote database becomes available
>Severity:      
>Priority:      
>Category:      mysql
>Class:         
>Release:       mysql-3.23.49 (Source distribution)

>Environment:
        
System: Linux irc1 2.4.19-pre10 #1 Sat Jun 8 03:00:02 EEST 2002 i686 unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)
Compilation info: CC='gcc'  CFLAGS=''  CXX='c++'  CXXFLAGS=''  LDFLAGS=''
LIBC: 
lrwxrwxrwx    1 root     root           13 Jun  8 02:24 /lib/libc.so.6 -> libc-2.2.5.so
-rwxr-xr-x    1 root     root      1153784 Apr 28 12:57 /lib/libc-2.2.5.so
-rw-r--r--    1 root     root      2390922 Apr 28 12:58 /usr/lib/libc.a
-rw-r--r--    1 root     root          178 Apr 28 12:58 /usr/lib/libc.so
-rw-r--r--    1 root     root       726660 Mar 24 06:56 /usr/lib/libc-client.so.2001
Configure command: ./configure  --prefix=/usr --exec-prefix=/usr 
--libexecdir=/usr/sbin --datadir=/usr/share --sysconfdir=/etc/mysql 
--localstatedir=/var/lib/mysql --includedir=/usr/include --infodir=/usr/share/info 
--mandir=/usr/share/man --enable-shared --with-libwrap --enable-assembler 
--with-berkeley-db --with-innodb --enable-static --enable-shared --enable-local-infile 
--with-raid --enable-thread-safe-client --without-readline 
--with-unix-socket-path=/var/run/mysqld/mysqld.sock --with-mysqld-user=mysql 
--without-bench --with-client-ldflags=-lstdc++ --with-extra-charsets=all


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to