Also it does appear that my payload is being generated properly just from looking at the error. https://i.imgur.com/OAIxHRy.png
SQLSTATE[HY000] [2006] MySQL server has gone away
Running into an error when I try and run a Job. It only happens occasionally while processing the job (usually when the data being processed is large).
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Through some googling I found this article: https://laravel-news.com/laravel-and-mysql-8-fixing-mysql-server-has-gone-away-error
Which, seems geared to Linux users. Right now I am using XAMPP on Windows. So I opened my XAMPP user control panel, opened the Config file for MySQL. Added to my config file
[mysqld]
default_authentication_plugin=mysql_native_password
Restarted the Laravel server, XAMPP, MySQL. And I am still getting this error.
I know the Job functions properly with small amount of data (234 entries into the database through the job works fine, 9,000 entries does not). So I am assuming this is not a problem with the actual code inside the Job class I have. Previously while making a different job that mostly did the same thing (yay troubleshooting!) I never had received this error and the Job was able to process 40,000 entries.
I am assuming that I am getting this error because it is timing out while trying to create the payload for the job? Just not sure what's going on here.
Yeah I have a standard HDD which is probably the difference we are experiencing. For those of you who are googling and reading form the future (hello future people) I resolved this issue by modifying my MySQL config file.
I changed
max_allowed_packet
under [mysqld] to 10M though, depending on the size of the data you are passing who knows you may need more. 10mb in a single MySQL field is a lot of data though so if you are passing more than that into a single field maybe its time to re-evaluate what your process is
I did also add default_authentication_plugin=mysql_native_password to the same section as per the advice of the article linked above. Though, I don't think that actually resolved or changed anything. That was the first thing I tried and it didn't actually work until I changed the max_allowed_packet to be larger. I am leaving it in there since it doesn't seem to hurt anything and I am not curious to find out how everything behaves if I remove it. 99.99% sure the packet size was what fixed it.
EDIT: Just to further clarify so you aren't going "ok well that fixes it by why did it fix it". I believe what was happening was that my Job was pretty dang large. Not only was it a lengthy complex operation itself but the dataset it ultimately needed to process through was very large. MySQL could not physically enter all the information required into the payload field of the Jobs table because there was a limitation on the size of what could be stored in a MySQL field. Bumping that size up allowed me to store my Job properly in the Jobs table.
Please or to participate in this conversation.