PDA

View Full Version : Query causing MySQL server has gone away


zero477
12-06-2016, 08:00 PM
Any idea of why this query is causing the error:


Database error in vBulletin 4.2.3:

Invalid SQL:

SELECT

pollvote.voteoption,

pollvote.userid

FROM pollvote

WHERE

pollvote.pollid = '2'

AND pollvote.userid != '1'

AND pollvote.voteoption <= '3'

LIMIT 4;



MySQL Error : MySQL server has gone away

Error Number : 2006

Request Date : Tuesday, December 6th 2016 @ 03:32:52 PM

Error Date : Tuesday, December 6th 2016 @ 03:33:27 PM



Referrer :

IP Address : 52.5.133.46

Username : No registrado

Classname : vB_Database_MySQLi

MySQL Version :

Dave
12-06-2016, 08:06 PM
There are many things that could cause this, refer to the list at: http://dev.mysql.com/doc/refman/5.7/en/gone-away.html

zero477
12-06-2016, 08:10 PM
Thanks Dave!!

--------------- Added 1481062567 at 1481062567 ---------------

There are many things that could cause this, refer to the list at: http://dev.mysql.com/doc/refman/5.7/en/gone-away.html

Hello Dave,

Following your adivce I saw this in the link you provided:

"You tried to run a query after closing the connection to the server. This indicates a logic error in the application that should be corrected."

I have some widgets that connect to a different DATABASE that the one that has vbulletin. Maybe this is why the error is happening.

Do you know what happens if I connect to another database in a widget and then in another use vbulletin's database class to do the query?

I use vbulletin's database class to do the query that.

What logic should I use in these widgets that connect to external databases?

Dave
12-06-2016, 08:30 PM
Multiple database connections should work fine, unless the code of the widget closes the database connection of vBulletin. If you disable the widget, does it work?

zero477
12-06-2016, 10:30 PM
Hello dave,

Thanks again for your quick response.

It normally works (with or without the widget), sometimes i get an email from vbulletin alerting me about this error. But it usually works.

Greetings,
Eddie

Dave
12-06-2016, 10:51 PM
If it's an inconsistent problem then your widgets might not be the cause. Are those widgets sidebar blocks or something else? Try setting cache time to 0 (no caching) and see what happens.

zero477
12-06-2016, 11:11 PM
If it's an inconsistent problem then your widgets might not be the cause. Are those widgets sidebar blocks or something else? Try setting cache time to 0 (no caching) and see what happens.

I currently do not catch. I will try setting up it with catching an see if that makes the fix!

Alstublieft again Dave! (I have seen your site, you look like a great developer. I lived in Groningen for 2 years and now live in Mexico I will keep in touch)