From: Jim Winstead Date: September 13 2005 6:13pm Subject: bk commit into 4.1 tree (jimw:1.2434) BUG#8731 List-Archive: http://lists.mysql.com/internals/29763 X-Bug: 8731 Message-Id: <20050913181305.94310A843F@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 4.1 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2434 05/09/13 11:13:01 jimw@stripped +8 -0 Fix wait_timeout handling on Mac OS X. (Bug #8731) This fix appears to expose another bug in I/O handling on Mac OS X, which causes several replication tests to fail. mysql-test/t/wait_timeout.test 1.1 05/09/13 11:12:58 jimw@stripped +11 -0 New BitKeeper file ``mysql-test/t/wait_timeout.test'' mysql-test/t/wait_timeout-master.opt 1.1 05/09/13 11:12:58 jimw@stripped +1 -0 New BitKeeper file ``mysql-test/t/wait_timeout-master.opt'' mysql-test/r/wait_timeout.result 1.1 05/09/13 11:12:58 jimw@stripped +8 -0 New BitKeeper file ``mysql-test/r/wait_timeout.result'' sql/net_serv.cc 1.76 05/09/13 11:12:58 jimw@stripped +2 -0 Set the read timeout alarm even when doing what we think is a non-blocking read on systems which sometimes block on a supposedly non-blocking read. sql/mysqld.cc 1.596 05/09/13 11:12:58 jimw@stripped +3 -1 Use sigaction() to set handler for THR_SERVER_ALARM so that no flags are set. mysql-test/t/wait_timeout.test 1.0 05/09/13 11:12:58 jimw@stripped +0 -0 BitKeeper file /home/jimw/my/mysql-4.1-8731/mysql-test/t/wait_timeout.test mysql-test/t/wait_timeout-master.opt 1.0 05/09/13 11:12:58 jimw@stripped +0 -0 BitKeeper file /home/jimw/my/mysql-4.1-8731/mysql-test/t/wait_timeout-master.opt mysql-test/r/wait_timeout.result 1.0 05/09/13 11:12:58 jimw@stripped +0 -0 BitKeeper file /home/jimw/my/mysql-4.1-8731/mysql-test/r/wait_timeout.result mysys/thr_alarm.c 1.46 05/09/13 11:12:57 jimw@stripped +7 -1 Use sigaction() to set handler for THR_SERVER_ALARM so that no flags are set. include/my_pthread.h 1.81 05/09/13 11:12:57 jimw@stripped +1 -1 Handle HAVE_DARWIN_THREADS rename to HAVE_DARWIN5_THREADS configure.in 1.395 05/09/13 11:12:57 jimw@stripped +3 -3 Handle HAVE_DARWIN_THREADS being renamed to HAVE_DARWIN5_THREADS and only enable it for Darwin 5.x, since threading was improved in later versions. Also add HAVE_BROKEN_NONBLOCK_READ to Darwin configuration. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-4.1-8731 --- 1.394/configure.in 2005-09-12 16:47:58 -07:00 +++ 1.395/configure.in 2005-09-13 11:12:57 -07:00 @@ -1102,7 +1102,7 @@ *darwin5*) if test "$ac_cv_prog_gcc" = "yes" then - FLAGS="-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" + FLAGS="-traditional-cpp -DHAVE_DARWIN5_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" CFLAGS="$CFLAGS $FLAGS" CXXFLAGS="$CXXFLAGS $FLAGS" MAX_C_OPTIMIZE="-O" @@ -1112,7 +1112,7 @@ *darwin6*) if test "$ac_cv_prog_gcc" = "yes" then - FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH" + FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DHAVE_BROKEN_NONBLOCK_READ" CFLAGS="$CFLAGS $FLAGS" CXXFLAGS="$CXXFLAGS $FLAGS" MAX_C_OPTIMIZE="-O" @@ -1122,7 +1122,7 @@ # don't forget to escape [] like above if test "$ac_cv_prog_gcc" = "yes" then - FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT" + FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DHAVE_BROKEN_NONBLOCK_READ" CFLAGS="$CFLAGS $FLAGS" CXXFLAGS="$CXXFLAGS $FLAGS" MAX_C_OPTIMIZE="-O" --- 1.80/include/my_pthread.h 2005-09-12 10:19:53 -07:00 +++ 1.81/include/my_pthread.h 2005-09-13 11:12:57 -07:00 @@ -409,7 +409,7 @@ #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } #endif -#ifdef HAVE_DARWIN_THREADS +#ifdef HAVE_DARWIN5_THREADS #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) #define pthread_kill(A,B) pthread_dummy(0) #define pthread_condattr_init(A) pthread_dummy(0) --- 1.45/mysys/thr_alarm.c 2005-06-28 05:06:11 -07:00 +++ 1.46/mysys/thr_alarm.c 2005-09-13 11:12:57 -07:00 @@ -115,7 +115,13 @@ #endif #else pthread_sigmask(SIG_UNBLOCK, &s, NULL); - sigset(THR_SERVER_ALARM,process_alarm); + { + struct sigaction sact; + sact.sa_flags= 0; + bzero((char*) &sact, sizeof(sact)); + sact.sa_handler= process_alarm; + sigaction(THR_SERVER_ALARM, &sact, (struct sigaction*) 0); + } #endif DBUG_VOID_RETURN; } --- 1.595/sql/mysqld.cc 2005-09-06 11:18:40 -07:00 +++ 1.596/sql/mysqld.cc 2005-09-13 11:12:58 -07:00 @@ -2002,7 +2002,6 @@ if (test_flags & TEST_SIGINT) sigset(THR_KILL_SIGNAL,end_thread_signal); - sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called! if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL)) { @@ -2058,6 +2057,9 @@ sa.sa_flags = 0; sa.sa_handler = print_signal_warning; sigaction(SIGHUP, &sa, (struct sigaction*) 0); + sa.sa_flags = 0; + sa.sa_handler = print_signal_warning; + sigaction(THR_SERVER_ALARM, &sa, (struct sigaction*) 0); #ifdef SIGTSTP sigaddset(&set,SIGTSTP); #endif --- 1.75/sql/net_serv.cc 2005-09-07 03:59:02 -07:00 +++ 1.76/sql/net_serv.cc 2005-09-13 11:12:58 -07:00 @@ -681,7 +681,9 @@ net->reading_or_writing=1; thr_alarm_init(&alarmed); #ifndef NO_ALARM +#ifndef HAVE_BROKEN_NONBLOCK_READ if (net_blocking) +#endif thr_alarm(&alarmed,net->read_timeout,&alarm_buff); #else vio_timeout(net->vio, 0, net->read_timeout); --- New file --- +++ mysql-test/r/wait_timeout.result 05/09/13 11:12:58 select 1; 1 1 select 2; ERROR HY000: MySQL server has gone away select 3; 3 3 --- New file --- +++ mysql-test/t/wait_timeout-master.opt 05/09/13 11:12:58 --wait-timeout=2 --- New file --- +++ mysql-test/t/wait_timeout.test 05/09/13 11:12:58 # # Bug #8731: wait_timeout does not work on Mac OS X # --disable_reconnect select 1; # wait_timeout is 2, so we should get disconnected now --sleep 5 --error 2006 select 2; --enable_reconnect select 3;