diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2002-11-23 18:41:26 +0200 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2002-11-23 18:41:26 +0200 |
commit | f7eca604785643f203f4f9edee7e7ea024c79570 (patch) | |
tree | 3d0019d3b7b5315d58bdb48769d361d96ad9360e /vio | |
parent | f81084a2e0003f2d6ef1d263d8c312903966e8ff (diff) | |
download | mariadb-git-f7eca604785643f203f4f9edee7e7ea024c79570.tar.gz |
FreeBSD patch by Jeremy Zawodny.
His explanation:
The socket on which MySQL listens for new connections on a blocking
socket most of the time but is set to non-blocking during the
accept() of the new connection. Due to a bug in the kernel, the new
socket returned by accept() is a blocking socket but returns the
O_NONBLOCK flag when queried via fcntl(F_GETFL). That is, the file
descriptor and the underlying socket don't agree on the blocking
mode.
Since MySQL determines via fcntl(F_GETFL) that the socket is
non-blocking, it expects the first read() in my_real_read to not
block, so it doesn't enable the timeout alarm. However, the read
does block, and thus there's no timeout alarm. The thread kill
(which relies on rescheduling the timeout alarm) also does not work
as a consequence.
The bug shows itself if you build MySQL with LinuxThreads support
(needed for SMP on FreeBSD). Issuing a KILL command in MySQL won't be
"noticed" by the "killed" thread until it runs another query--that
makes KILL pretty useless. And the wait_timeout doesn't work either.
vio/vio.c:
FreeBSD patch by Jeremy Zawodny
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/vio/vio.c b/vio/vio.c index bed380c6cd9..d822651cca6 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -98,6 +98,9 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) vio->sd); #if !defined(___WIN__) && !defined(__EMX__) && !defined(OS2) #if !defined(NO_FCNTL_NONBLOCK) +#if defined(__FreeBSD__) + fcntl(sd, F_SETFL, vio->fcntl_mode); /* Yahoo! FreeBSD patch */ +#endif vio->fcntl_mode = fcntl(sd, F_GETFL); #elif defined(HAVE_SYS_IOCTL_H) /* hpux */ /* Non blocking sockets doesn't work good on HPUX 11.0 */ |