# Qmail, Vpopmail, and MySql Random failure

## laidback_01

This has become the dreaded log entry for me - I can't get rid of it:

authdaemond: vmysql: sql error[3]: MySQL server has gone away

Okay, so here's the original setup, I followed the howto without issue, worked fine for quite a while.  Using XEN servers, so my mail server is located on a different server than my database server.  Had vpopmail.conf looking to a remote mysql(5.0) server for it's authentication.  It worked great for 3 months, then I started seeing the above error once in a while - it would never be an issue, as the system would reconnect to the mysql server immediately, so I ignored it.

Add about a week's time and that vmysql could no longer re-connect to mysql.  It would just time out and stay that way.  Not a good thing...   So, I googled for it, and read that hey, it's a mysql 5.0 issue, downgrade to 4.1.  Well okay, I put up another mysql server on port 3307 and went for it - worked without failure for a full day and then the same error came up.

So, I put up a mysql 5.0 server on localhost, same thing after about a day.  

My most recent try is still mysql5.0 on localhost but with symlinks from /var/run/mysqld/mysqld.sock to /tmp/mysqld.sock    Then I guess I'll drop to mysql4.1 and maybe even 4.0

I'm thinking though, that it's not actuall mysql that's at fault, and somewhere along the lines of doing upgrades to software I installed a newer version of vpopmail that has this bug in it.  

Please tell me someone else has had this issue.

Thanks, have a good day.

----------

## Netset

yep, see here, but to my knowledge no solutions yet.

Igor

----------

## laidback_01

I'd try to solve someof this but I'm not a suitable coder for it.  My frustration level is high enough now that I'm looking to dump vpopmail in search of some other qmail pop/imap authentication method that works with mysql well.  Anyone have a suggestion?

----------

## laidback_01

as per someone else's idea, I put in a crontab to restart courier-authlib every 30 mins.  

What a horrid thing... but it's the only way to cover the symtoms of this problem right now.

----------

## Gio

Posted in the above referenced message - there are default timeouts in the new mysql called interactive_timeout and wait_timeout, and they appear to be set to 22800, or a bit over six hours. I found that if I kept a local mail client running that I didn't get the problem. I've changed the timeouts (in the /etc/mysql conf file) to 86400 (one day) and 604800 (one week) respectively - I know, a bit overkill, but I just want to see if the problem goes away. Anyone else please chime in...

----------

## Gio

Well that worked for me. First time in an age I've been able to start my mail client and not enter the password for the local account.

----------

## laidback_01

Well, cool, I'll try that today.  Right now I'm hungry, but later  :Wink: .  Thanks for the tip, I'll post the results asap.

Jack

----------

## laidback_01

Okay, well, I've been experimenting with several different values, none of which are really helping all that much.

SO, I went back to the crontab way of resetting the connection every hour.

There's GOT to be something better than courier for the method of authentication when using mysql as the db.

----------

## kenjiru

I have the same problem, it's getting me mad. Have you found a solution for this?

----------

## Dominus_Gentoo

Same problem here...

After about one day i get "MySQL Server has gone away" on MySQL 5.0.18-r30

downgraded to MySQL 4.1 -> same problem.

before we used a cdb file - worked fine. probably go back to that with vconvert. 

i´ll try the workaround with the crontab for restarting courier-authlib

doesn´t look like a mysql problem.

it´s been a while since this "bug" was found, any news yet?

greetz

----------

## tuxman

anyone found a patch to this.. I'm stuck in the same issue now.. dont really want to ditch mysql for this, and I just re-converted to the new data type

stuctures in mysql5, I figure by now there  has to be a patch for it.. 

I found one online, but it doesn't seem to incoperate into the ebuild as it fails evertime I try to add it in, so it may already be in there I'm not sure.

http://www.mail-archive.com/vchkpw@inter7.com/msg23689.html would be the info on it.. 

has any one got this working ?

Dave

----------

## Crymson

I looked at the patch you mentioned, and the source from the 5.4.16 package, and that patch has already been incorporated, so it won't solve our problems.  (It could also explain why you can't add the patch - it's already there.)

Looks like the best solution is to hourly run a cron job to restart courier-authlib.  Here's hoping vpopmail 5.4.17 or whatever the next one is doesn't fsck everything up like this one does.

----------

## Kaklz

I had the same problem, which I guess is fixed now. 

At the beginning I tried to use the hourly cron to fix it, however at some point it didn't work either - I needed to restart every 10 minutes and still the problem appeared from time to time. 

What I did was - I upgraded courier-imap package, as that's the package which includes the authorization stuff. I had the problem with 3.x version, however, when I upgraded to 4.x the problem disappeared, at least I think so - I removed the auth restart script and from yesterday evening I see no 'MySQL server has gone away' messages in my logs.

----------

