Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
tonix (Antonio Nati) wrote: At 23.15 12/07/2006, you wrote: tonix (Antonio Nati) wrote: At 18.24 12/07/2006, you wrote: The vpopmail module to authdaemon is might be missing the vpopmail vclose() function. Are you using mysql module instead of authvchkpw? Is the configuration easy as it looks or did you make anything special/tricky on it? I'm using the standard authvchkpw module with no special installation. Regards, Rick
Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
At 23.15 12/07/2006, you wrote: tonix (Antonio Nati) wrote: At 18.24 12/07/2006, you wrote: The vpopmail module to authdaemon is might be missing the vpopmail vclose() function. At a first look, you are right. Following is the code related to closing connection. static void authvchkpwclose() { } It lacks any code relative to vpopmail vclose. But in my logs I don't have any "reconnect" trace, so I suppose authdaemon is always using the same connection (and I see it is growing anyway). The memory "abuse" must be elsewhere. Is anyone using authdaemon mysql authentication and having the same problems? Hi, I'm using authdaemon mysql but I'm not seeing that problem. Are you using mysql module instead of authvchkpw? Is the configuration easy as it looks or did you make anything special/tricky on it? Ciao, Tonino Regards, Rick
Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
At 23.02 12/07/2006, you wrote: On Wednesday 12 July 2006 13:48, tonix (Antonio Nati) wrote: > At 18.24 12/07/2006, you wrote: > >The vpopmail module to authdaemon is might be missing > >the vpopmail vclose() function. > > At a first look, you are right. > > Following is the code related to closing connection. > static void authvchkpwclose() > { > } > It lacks any code relative to vpopmail vclose. > > But in my logs I don't have any "reconnect" trace, so I suppose > authdaemon is always using the same connection (and I see it is > growing anyway). The memory "abuse" must be elsewhere. how about running authdaemon under valgrind, then performing a couple thousand auth attempts against it? I never used it. I'll give it a try (hope next week). Thanks, Tonino -Jeremy -- Jeremy Kitchen ++ [EMAIL PROTECTED] http://www.pirate-party.us/ -- defend your rights
Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
tonix (Antonio Nati) wrote: At 18.24 12/07/2006, you wrote: The vpopmail module to authdaemon is might be missing the vpopmail vclose() function. At a first look, you are right. Following is the code related to closing connection. static void authvchkpwclose() { } It lacks any code relative to vpopmail vclose. But in my logs I don't have any "reconnect" trace, so I suppose authdaemon is always using the same connection (and I see it is growing anyway). The memory "abuse" must be elsewhere. Is anyone using authdaemon mysql authentication and having the same problems? Hi, I'm using authdaemon mysql but I'm not seeing that problem. Regards, Rick
Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
On Wednesday 12 July 2006 13:48, tonix (Antonio Nati) wrote: > At 18.24 12/07/2006, you wrote: > >The vpopmail module to authdaemon is might be missing > >the vpopmail vclose() function. > > At a first look, you are right. > > Following is the code related to closing connection. > static void authvchkpwclose() > { > } > It lacks any code relative to vpopmail vclose. > > But in my logs I don't have any "reconnect" trace, so I suppose > authdaemon is always using the same connection (and I see it is > growing anyway). The memory "abuse" must be elsewhere. how about running authdaemon under valgrind, then performing a couple thousand auth attempts against it? -Jeremy -- Jeremy Kitchen ++ [EMAIL PROTECTED] http://www.pirate-party.us/ -- defend your rights pgpoof3ymduet.pgp Description: PGP signature
Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
At 18.24 12/07/2006, you wrote: The vpopmail module to authdaemon is might be missing the vpopmail vclose() function. At a first look, you are right. Following is the code related to closing connection. static void authvchkpwclose() { } It lacks any code relative to vpopmail vclose. But in my logs I don't have any "reconnect" trace, so I suppose authdaemon is always using the same connection (and I see it is growing anyway). The memory "abuse" must be elsewhere. Is anyone using authdaemon mysql authentication and having the same problems? Tonino If so, then every connection to the authdaemon would open a new mysql connection, which allocates memory. Then without the vclose the memory never gets released and eventually runs out of memory. Ken Jones tonix (Antonio Nati) wrote: I don't know if this is a limit of this useful patch (I don't think so), or more likely of the vpopmail library (I feel could be), or yet of courier authdaemon, but after more than ten days of successfull running, I've got this error: Jul 11 16:24:33 myserver authdaemond: ^GOut of memory (Needed 8164 bytes) Jul 11 16:24:33 myserver authdaemond: vmysql: sql error[3]: Jul 11 16:24:33 myserver authdaemond: Attempting to rebuild connection to SQL server Jul 11 16:24:33 myserver authdaemond: ^GOut of memory (Needed 8164 bytes) Jul 11 16:24:33 myserver authdaemond: vmysql: connection rebuild failed: So, I'm adding an authdaemon restart each morning (early) to solve the problem. Note: after stopping and restarting courier authdaemon, 1200 MB of system memory have been released (here I have 4GB of system memory). I feel like vpopmail calls just alloc() memory and never release it, as they have been probably designed for one shot program. When they are used within a "permanent" service, calling them dozen thousands times, they waste memory and cause problems. Any one else if watching his courier authdaemon growing? Tonino At 21.20 29/06/2006, you wrote: This patch is in the upcoming 5.4.17 release. -Tom On May 29, 2006, at 7:05 AM, Ron Gage wrote: Greetings: I don't know if anyone in here is encountering this problem (yet), but it has been affecting me for the past few weeks - ever since I upgraded my MySQL server to 5.0.19. It took quite a bit of digging, but I believe I have found the problem. To describe the problem: when you run vpopmail in MySQL mode, with courier-authdaemond and MySQL v5.0 or later, you will find that for the first 8 hours, everything works just fine, but after 8 hours, nobody will be able to authenticate to the email server and you will see "MySQL server has gone away" errors in the maillog. The cause of the problem is that in MySQL 5.0 (and probably some 4.1 releases), MySQL implements a new timeout definition for connections, a timeout that ignores traffic. This timeout will shut down the socket thread from the MySQL side. The problem is that the client (vchkpw and friends) do not know/understand about this timeout and socket termination so they continue on in ignorate bliss until they try to send to the socket and find that it's no longer valid - literally "the server has gone away". The fix is to simply destroy the internal flags and file handles related to that socket, rebuild a new one, and try again. The included patch (inline and attached) implements this fix. Please note that there doesn't appear to be any way at this time to disable the timeout feature in MySQL. Please feel free to comment, tear apart, beat up, or otherwise rip to shreads my fix! -- Ron Gage (LPIC1 MCP A+ Net+) Westland, Michigan --- vmysql.c~ 2006-05-29 10:17:20.0 -0400 +++ vmysql.c 2006-05-29 10:17:20.0 -0400 @@ -465,7 +465,31 @@ ); if (mysql_query(&mysql_read,SqlBufRead)) { fprintf(stderr, "vmysql: sql error[3]: %s\n", mysql_error(&mysql_read)); - return(NULL); + /* Ron Gage - May 29, 2006 - With newer versions of MySQL, there is such a thing + as a connection timeout regardless of activity. By default under MySQL 5, this + timeout is 28800 seconds (8 hours). If your vpopmail system runs fine for the + first 8 hours, then stops authenticating, this timeout is your problem (especially + under authdaemond). + + What this code does is when an error is encountered, it first tries to drop and + rebuild a connection to the SQL server and tries again. If this second attempt + fails, then something other than the connection timeout is the problem. This fix + need to be implemented in other places but in my setup (Slackware 10.2, netqmail, + vpopmail, courier-authdaemond, courier-imapd and a few others), this is always where + the auth attempt died with a "SQL server has gone away" error. + */ + + fprintf(stderr, "Attempting to rebuild connection to SQL server\n"); + vclose(); + verrori = 0; + if ( (err=vauth_open_read()) != 0 ) { + verrori = err; + return(NULL); +
Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
At 18.24 12/07/2006, you wrote: The vpopmail module to authdaemon is might be missing the vpopmail vclose() function. I'm giving a fast look, but I don't see either close and open :-( . If so, then every connection to the authdaemon would open a new mysql connection, which allocates memory. Then without the vclose the memory never gets released and eventually runs out of memory. This is what authdaemon should not do. It open a first time for each child and then use the sames connection always (apart from the eight hours problem). So it must be something after the "connect" phase, something called thousands times. I'm trying to check, but I'll do better next week. Thanks, Tonino Ken Jones tonix (Antonio Nati) wrote: I don't know if this is a limit of this useful patch (I don't think so), or more likely of the vpopmail library (I feel could be), or yet of courier authdaemon, but after more than ten days of successfull running, I've got this error: Jul 11 16:24:33 myserver authdaemond: ^GOut of memory (Needed 8164 bytes) Jul 11 16:24:33 myserver authdaemond: vmysql: sql error[3]: Jul 11 16:24:33 myserver authdaemond: Attempting to rebuild connection to SQL server Jul 11 16:24:33 myserver authdaemond: ^GOut of memory (Needed 8164 bytes) Jul 11 16:24:33 myserver authdaemond: vmysql: connection rebuild failed: So, I'm adding an authdaemon restart each morning (early) to solve the problem. Note: after stopping and restarting courier authdaemon, 1200 MB of system memory have been released (here I have 4GB of system memory). I feel like vpopmail calls just alloc() memory and never release it, as they have been probably designed for one shot program. When they are used within a "permanent" service, calling them dozen thousands times, they waste memory and cause problems. Any one else if watching his courier authdaemon growing? Tonino At 21.20 29/06/2006, you wrote: This patch is in the upcoming 5.4.17 release. -Tom On May 29, 2006, at 7:05 AM, Ron Gage wrote: Greetings: I don't know if anyone in here is encountering this problem (yet), but it has been affecting me for the past few weeks - ever since I upgraded my MySQL server to 5.0.19. It took quite a bit of digging, but I believe I have found the problem. To describe the problem: when you run vpopmail in MySQL mode, with courier-authdaemond and MySQL v5.0 or later, you will find that for the first 8 hours, everything works just fine, but after 8 hours, nobody will be able to authenticate to the email server and you will see "MySQL server has gone away" errors in the maillog. The cause of the problem is that in MySQL 5.0 (and probably some 4.1 releases), MySQL implements a new timeout definition for connections, a timeout that ignores traffic. This timeout will shut down the socket thread from the MySQL side. The problem is that the client (vchkpw and friends) do not know/understand about this timeout and socket termination so they continue on in ignorate bliss until they try to send to the socket and find that it's no longer valid - literally "the server has gone away". The fix is to simply destroy the internal flags and file handles related to that socket, rebuild a new one, and try again. The included patch (inline and attached) implements this fix. Please note that there doesn't appear to be any way at this time to disable the timeout feature in MySQL. Please feel free to comment, tear apart, beat up, or otherwise rip to shreads my fix! -- Ron Gage (LPIC1 MCP A+ Net+) Westland, Michigan --- vmysql.c~ 2006-05-29 10:17:20.0 -0400 +++ vmysql.c2006-05-29 10:17:20.0 -0400 @@ -465,7 +465,31 @@ ); if (mysql_query(&mysql_read,SqlBufRead)) { fprintf(stderr, "vmysql: sql error[3]: %s\n", mysql_error(&mysql_read)); -return(NULL); +/* Ron Gage - May 29, 2006 - With newer versions of MySQL, there is such a thing +as a connection timeout regardless of activity. By default under MySQL 5, this +timeout is 28800 seconds (8 hours). If your vpopmail system runs fine for the +first 8 hours, then stops authenticating, this timeout is your problem (especially +under authdaemond). + +What this code does is when an error is encountered, it first tries to drop and +rebuild a connection to the SQL server and tries again. If this second attempt +fails, then something other than the connection timeout is the problem. This fix +need to be implemented in other places but in my setup (Slackware 10.2, netqmail, +vpopmail, courier-authdaemond, courier-imapd and a few others), this is always where +the auth attempt died with a "SQL server has gone away" error. +*/ + +fprintf(stderr, "Attempting to rebuild connection to SQL server\n"); +vclose(); +verrori = 0; +if ( (err=vauth_open_read()) != 0 ) { + verrori = err; +
Re: [vchkpw] vchkpw/vmysql and Mysql 5 with courier -authlib
The vpopmail module to authdaemon is might be missing the vpopmail vclose() function. If so, then every connection to the authdaemon would open a new mysql connection, which allocates memory. Then without the vclose the memory never gets released and eventually runs out of memory. Ken Jones tonix (Antonio Nati) wrote: I don't know if this is a limit of this useful patch (I don't think so), or more likely of the vpopmail library (I feel could be), or yet of courier authdaemon, but after more than ten days of successfull running, I've got this error: Jul 11 16:24:33 myserver authdaemond: ^GOut of memory (Needed 8164 bytes) Jul 11 16:24:33 myserver authdaemond: vmysql: sql error[3]: Jul 11 16:24:33 myserver authdaemond: Attempting to rebuild connection to SQL server Jul 11 16:24:33 myserver authdaemond: ^GOut of memory (Needed 8164 bytes) Jul 11 16:24:33 myserver authdaemond: vmysql: connection rebuild failed: So, I'm adding an authdaemon restart each morning (early) to solve the problem. Note: after stopping and restarting courier authdaemon, 1200 MB of system memory have been released (here I have 4GB of system memory). I feel like vpopmail calls just alloc() memory and never release it, as they have been probably designed for one shot program. When they are used within a "permanent" service, calling them dozen thousands times, they waste memory and cause problems. Any one else if watching his courier authdaemon growing? Tonino At 21.20 29/06/2006, you wrote: This patch is in the upcoming 5.4.17 release. -Tom On May 29, 2006, at 7:05 AM, Ron Gage wrote: Greetings: I don't know if anyone in here is encountering this problem (yet), but it has been affecting me for the past few weeks - ever since I upgraded my MySQL server to 5.0.19. It took quite a bit of digging, but I believe I have found the problem. To describe the problem: when you run vpopmail in MySQL mode, with courier-authdaemond and MySQL v5.0 or later, you will find that for the first 8 hours, everything works just fine, but after 8 hours, nobody will be able to authenticate to the email server and you will see "MySQL server has gone away" errors in the maillog. The cause of the problem is that in MySQL 5.0 (and probably some 4.1 releases), MySQL implements a new timeout definition for connections, a timeout that ignores traffic. This timeout will shut down the socket thread from the MySQL side. The problem is that the client (vchkpw and friends) do not know/understand about this timeout and socket termination so they continue on in ignorate bliss until they try to send to the socket and find that it's no longer valid - literally "the server has gone away". The fix is to simply destroy the internal flags and file handles related to that socket, rebuild a new one, and try again. The included patch (inline and attached) implements this fix. Please note that there doesn't appear to be any way at this time to disable the timeout feature in MySQL. Please feel free to comment, tear apart, beat up, or otherwise rip to shreads my fix! -- Ron Gage (LPIC1 MCP A+ Net+) Westland, Michigan --- vmysql.c~ 2006-05-29 10:17:20.0 -0400 +++ vmysql.c2006-05-29 10:17:20.0 -0400 @@ -465,7 +465,31 @@ ); if (mysql_query(&mysql_read,SqlBufRead)) { fprintf(stderr, "vmysql: sql error[3]: %s\n", mysql_error(&mysql_read)); -return(NULL); +/* Ron Gage - May 29, 2006 - With newer versions of MySQL, there is such a thing +as a connection timeout regardless of activity. By default under MySQL 5, this +timeout is 28800 seconds (8 hours). If your vpopmail system runs fine for the +first 8 hours, then stops authenticating, this timeout is your problem (especially +under authdaemond). + +What this code does is when an error is encountered, it first tries to drop and +rebuild a connection to the SQL server and tries again. If this second attempt +fails, then something other than the connection timeout is the problem. This fix +need to be implemented in other places but in my setup (Slackware 10.2, netqmail, +vpopmail, courier-authdaemond, courier-imapd and a few others), this is always where +the auth attempt died with a "SQL server has gone away" error. +*/ + +fprintf(stderr, "Attempting to rebuild connection to SQL server\n"); +vclose(); +verrori = 0; +if ( (err=vauth_open_read()) != 0 ) { + verrori = err; + return(NULL); +} +if (mysql_query(&mysql_read, SqlBufRead)) { + fprintf (stderr, "vmysql: connection rebuild failed: %s\n", mysql_error(&mysql_read)); + return(NULL); +} } if (!(res_read = mysql_store_result(&mysql_read))) { This message was sent using IMP, the Internet Messaging