Skip to main content

Ralsina.Me — Roberto Alsina's website

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

Well, I am in the mid­dle of mi­grat­ing a rather large mail server, us­ing qmail+vpop­mail+mysql+­couri­er-imap.

And just when it's start­ing in­to pro­duc­tion us­age, we find the er­ror in the ti­tle.

A lot.

Sad­ly, since that er­ror in­di­cates a failed MySQL query, it means you get stuff like ran­dom auth fail­ures. Which sucks a lot.

Googling gave a lot of hints. But noth­ing would fix it.

Un­til.... lucky strike.

So, I will put my so­lu­tion here for fu­ture googler­s.

If you see this:

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

Do the fol­low­ing:

  1. Check if you are ex­ceed­ing mysql's max_­­con­nec­­tions pa­ram­e­ter. The de­­fault is 100.

  2. Check if your cpu can take the load. (No, don't look at the load av­er­age. Look at the CPU us­age).

  3. Make re­al­­ly sure that vpop­­mail and couri­er-au­th­lib are built us­ing the ex­act mysql you have in­­stalled. No, it does­n't mat­ter if it's the same ver­­sion. Go, and re­build the things!

That fixed it for me.

On oth­er bizarre news about this server, I have low CPU us­age (95% idle), low IO (io­stat re­ports un­der 1M­B/sec, 40 tp­s), yet I have a load that can go up to 120.

Yet, in­ter­ac­tive re­sponse is fine.

Weird.

KDE News / 2006-04-04 01:50:

Informative KDE blog.

sergio / 2006-04-04 01:51:

Hola Roberto, si el server es un Intel, probá desactivando el HyperThreading. Algunas veces tenerlo activado trae problemas raros de este tipo. Saludos!