|
Line
Link Here
|
| 0 |
-- vmysql.c~ 2006-05-29 10:17:20.000000000 -0400 |
0 |
++ vmysql.c 2006-05-29 10:17:20.000000000 -0400 |
|
Lines 465-471
Link Here
|
| 465 |
); |
465 |
); |
| 466 |
if (mysql_query(&mysql_read,SqlBufRead)) { |
466 |
if (mysql_query(&mysql_read,SqlBufRead)) { |
| 467 |
fprintf(stderr, "vmysql: sql error[3]: %s\n", mysql_error(&mysql_read)); |
467 |
fprintf(stderr, "vmysql: sql error[3]: %s\n", mysql_error(&mysql_read)); |
| 468 |
return(NULL); |
468 |
/* Ron Gage - May 29, 2006 - With newer versions of MySQL, there is such a thing |
|
|
469 |
as a connection timeout regardless of activity. By default under MySQL 5, this |
| 470 |
timeout is 28800 seconds (8 hours). If your vpopmail system runs fine for the |
| 471 |
first 8 hours, then stops authenticating, this timeout is your problem (especially |
| 472 |
under authdaemond). |
| 473 |
|
| 474 |
What this code does is when an error is encountered, it first tries to drop and |
| 475 |
rebuild a connection to the SQL server and tries again. If this second attempt |
| 476 |
fails, then something other than the connection timeout is the problem. This fix |
| 477 |
need to be implemented in other places but in my setup (Slackware 10.2, netqmail, |
| 478 |
vpopmail, courier-authdaemond, courier-imapd and a few others), this is always where |
| 479 |
the auth attempt died with a "SQL server has gone away" error. |
| 480 |
*/ |
| 481 |
|
| 482 |
fprintf(stderr, "Attempting to rebuild connection to SQL server\n"); |
| 483 |
vclose(); |
| 484 |
verrori = 0; |
| 485 |
if ( (err=vauth_open_read()) != 0 ) { |
| 486 |
verrori = err; |
| 487 |
return(NULL); |
| 488 |
} |
| 489 |
if (mysql_query(&mysql_read, SqlBufRead)) { |
| 490 |
fprintf (stderr, "vmysql: connection rebuild failed: %s\n", mysql_error(&mysql_read)); |
| 491 |
return(NULL); |
| 492 |
} |
| 469 |
} |
493 |
} |
| 470 |
if (!(res_read = mysql_store_result(&mysql_read))) { |
494 |
if (!(res_read = mysql_store_result(&mysql_read))) { |