Re: handling mysql errors
The script needs the database so if the DB drops i'll wait for it to reconnect in an infinite loop. If that doesn't sound too weird then it's the expected behaviour.
The output from my script is as follows ( this ran over a 12 hour period and the 'Timed out' takes an hour or more to be trapped ) where it hangs on ID # 387:
61 362 +363 +364 +365 +366 367 368 369 370 371 372 373 374 375 376 377
+ 378 379 380 381 382 383 384 385 386 387
Timed out
387 Timed out
387 DB Connected
387 Timed out
387 DB Connected
387 Timed out
387 DB Connected
387 Timed out
387 DB Connected
I did a perl DBI->trace on the queries and can see the last place before the hang is at the mysql_st_internal_execute as follows:
387 -> ping for DBD::mysql::db (DBI::db=HASH(0x81a75f0)~0x81a6964)
<- ping= 1 at ./test.pl line 65 via ./test.pl line 59
-> prepare for DBD::mysql::db (DBI::db=HASH(0x81a75f0)~0x81a6964 '
+SELECT * FROM monitor_list WHERE id = 387 LIMIT 1')
dbih_setup_handle(DBI::st=HASH(0x81cd488)=>DBI::st=HASH(0x81cd428)
+, DBD::mysql::st, 81cd0c8, Null!)
dbih_make_com(DBI::db=HASH(0x81a6964), 81a6c04, DBD::mysql::st, 22
+4, 0) thr#0
dbih_setup_attrib(DBI::st=HASH(0x81cd428), Err, DBI::db=HASH(0x81a
+6964)) SCALAR(0x815cdd8) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x81cd428), State, DBI::db=HASH(0x8
+1a6964)) SCALAR(0x815ce38) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x81cd428), Errstr, DBI::db=HASH(0x
+81a6964)) SCALAR(0x815ce08) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x81cd428), TraceLevel, DBI::db=HAS
+H(0x81a6964)) 15 (already defined)
dbih_setup_attrib(DBI::st=HASH(0x81cd428), FetchHashKeyName, DBI::
+db=HASH(0x81a6964)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0x81cd428), HandleSetErr, DBI::db=H
+ASH(0x81a6964)) undef (not defined)
dbih_setup_attrib(DBI::st=HASH(0x81cd428), HandleError, DBI::db=HA
+SH(0x81a6964)) undef (not defined)
Setting mysql_use_result to 0
<- prepare= DBI::st=HASH(0x81cd488) at ./test.pl line 65 via ./tes
+t.pl line 59
-> execute for DBD::mysql::st (DBI::st=HASH(0x81cd488)~0x81cd428)
-> dbd_st_execute for 081a6bc8
-> mysql_st_interal_execute
I should mention that I am on a Freebsd 5.4-RELEASE server and i recently upgraded from mysql 4.x to 5.x. Upon upgrade my script didn't hang anymore on the original table but when I made a duplicate test table I am noticing a different set of ID#'s that the script hangs on.
I compliled the mysql 5.x server with Linuxthreads and am wondering if there are still known issues between FREEBSD and MYSQL?