Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"MySQL server has gone away" on queue run #597

Closed
Coysh opened this issue Oct 7, 2021 · 23 comments
Closed

"MySQL server has gone away" on queue run #597

Coysh opened this issue Oct 7, 2021 · 23 comments

Comments

@Coysh
Copy link

Coysh commented Oct 7, 2021

Description
When some of my forms are submitted, they are added to the queue succesfully. But the problem is they are then stuck in the queue as "Reserved".

Looking at the log file, the error is to do with the MySQL server. But there are no other indications or reports across the site that the MySQL server has crashed.

2021-10-07 21:21:36 [-][1203][-][info][formie] Submission triggered for newBusinessBriefingForm.
2021-10-07 21:21:36 [-][1203][-][info][application] $_GET = [
    'p' => 'newbusiness'
]

$_POST = [
    'CRAFT_CSRF_TOKEN' => '••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••'
    'action' => 'formie/submissions/submit'
    'handle' => 'newBusinessBriefingForm'
    'fields' => [
        'clientName' => 'Tim Coysh Test'
        'clientContactLead' => 'Test'
        'clientEmailAddress' => 'tim@XXX'
        'activityType' => 'Retainer'
        'dateOfBrief' => [
            'date' => '2021-10-07'
        ]
        'estimatedBudget' => ''
        'projectName' => ''
        'durationOfProject' => ''
        'backgroundInformation' => 'Test'
        'marketingSupport' => ''
        'brandPositioningStatement' => ''
        'businessCharityObjectives' => 'Test'
        'whatDoYouHopeToAchieveByEngagingWithUs' => ''
        'prMessaging' => ''
        'primary' => ''
        'secondary' => ''
        'targetMedia' => ''
        'keySpokespeople' => ''
        'brandAmbassadors' => ''
        'competition' => ''
        'keyConsiderationsOrSensitivities' => ''
    ]
]
2021-10-07 21:21:37 [-][-][-][error][formie] Unable to update job info debug: “SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: UPDATE `craft_queue` SET `job`='O:34:\"verbb\\formie\\jobs\\SendNotification\":8:{s:12:\"submissionId\";i:61255;s:10:\"submission\";N;s:14:\"notificationId\";s:2:\"25\";s:12:\"notification\";N;s:5:\"email\";N;s:11:\"description\";N;s:30:\"\0craft\\queue\\BaseJob\0_progress\";i:0;s:35:\"\0craft\\queue\\BaseJob\0_progressLabel\";N;}' WHERE `id`='124649'” /home/515761.cloudwaysapps.com/hfvcruqxmf/public_html/vendor/yiisoft/yii2/db/Schema.php:678
2021-10-07 21:16:37 [-][-][-][info][application] $_GET = []

$_POST = []

Steps to reproduce
1.
2.

Form settings

Please pick from the options below.

  • Multi-page form: No
  • Submission Method: Ajax
  • Client-side Validation: Yes
  • Custom Form Templates: Yes

Additional info

  • Plugin version: 1.4.15
  • Craft version: 3.7.12
  • Multi-site: No
@engram-design
Copy link
Member

Can you share some details on your server setup (software, provider, specs), and MySQL version? It does sound like MySQL has fallen over, even briefly.

@Coysh
Copy link
Author

Coysh commented Oct 7, 2021 via email

@engram-design
Copy link
Member

How's the general traffic to the site, is it under load? Not using anything like Blitz for static caching? This is a low-level Craft error, so will need to investigate it further, but this would be the first report of this sort of error.

@Coysh
Copy link
Author

Coysh commented Oct 8, 2021

@engram-design Really low traffic.. Average load is close to 0.2 on the server.
We're not using Blitz or any caching, but it's a pretty basic static website so could install it - but unsure if that would fix the problem.

@Coysh
Copy link
Author

Coysh commented Oct 8, 2021

@engram-design Hey Josh, also looks like this problem is only happening with one specific form.. This is the queue info:
Screenshot 2021-10-08 at 10 18 45
:

@engram-design
Copy link
Member

Hmmm, how large is the form? Judging from the fields in your initial log output, it doesn't seem like much.

Really difficult to tell, without seeing your form setup I think. Something is clearly taking up resources, but unsure as to what, or how best to pinpoint that without getting my hands on the project. Will keep tinkering.

@engram-design
Copy link
Member

Closing due to inactivity

@Coysh
Copy link
Author

Coysh commented Nov 25, 2021

@engram-design - I'm still getting this issue. I left it, as I thought it might be a server issue. But it does seem to only apply to formie submissions.

This is another extract from logs of last night:

2021-11-25 02:04:43 [-][-][-][error][formie] Unable to update job info debug: “SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: UPDATE `craft_queue` SET `job`='O:34:\"verbb\\formie\\jobs\\SendNotification\":8:{s:12:\"submissionId\";i:73693;s:10:\"submission\";N;s:14:\"notificationId\";s:2:\"32\";s:12:\"notification\";N;s:5:\"email\";N;s:11:\"description\";N;s:30:\"\0craft\\queue\\BaseJob\0_progress\";i:0;s:35:\"\0craft\\queue\\BaseJob\0_progressLabel\";N;}' WHERE `id`='56943'” /home/515761.cloudwaysapps.com/hfvcruqxmf/public_html/vendor/yiisoft/yii2/db/Schema.php:678
2021-11-25 01:59:42 [-][-][-][info][application] $_GET = []

$_POST = []
2021-11-25 02:04:47 [-][-][-][error][formie] Unable to update job info debug: “SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: UPDATE `craft_queue` SET `job`='O:34:\"verbb\\formie\\jobs\\SendNotification\":8:{s:12:\"submissionId\";i:73822;s:10:\"submission\";N;s:14:\"notificationId\";s:2:\"32\";s:12:\"notification\";N;s:5:\"email\";N;s:11:\"description\";N;s:30:\"\0craft\\queue\\BaseJob\0_progress\";i:0;s:35:\"\0craft\\queue\\BaseJob\0_progressLabel\";N;}' WHERE `id`='92987'” /home/515761.cloudwaysapps.com/hfvcruqxmf/public_html/vendor/yiisoft/yii2/db/Schema.php:678
2021-11-25 01:59:47 [-][-][-][info][application] $_GET = []

$_POST = []
2021-11-25 02:10:15 [-][-][-][error][formie] Unable to update job info debug: “SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: UPDATE `craft_queue` SET `job`='O:34:\"verbb\\formie\\jobs\\SendNotification\":8:{s:12:\"submissionId\";i:73693;s:10:\"submission\";N;s:14:\"notificationId\";s:2:\"32\";s:12:\"notification\";N;s:5:\"email\";N;s:11:\"description\";N;s:30:\"\0craft\\queue\\BaseJob\0_progress\";i:0;s:35:\"\0craft\\queue\\BaseJob\0_progressLabel\";N;}' WHERE `id`='56943'” /home/515761.cloudwaysapps.com/hfvcruqxmf/public_html/vendor/yiisoft/yii2/db/Schema.php:678
2021-11-25 02:05:15 [-][-][-][info][application] $_GET = []

$_POST = []
2021-11-25 02:15:15 [-][-][-][error][formie] Unable to update job info debug: “SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: UPDATE `craft_queue` SET `job`='O:34:\"verbb\\formie\\jobs\\SendNotification\":8:{s:12:\"submissionId\";i:73822;s:10:\"submission\";N;s:14:\"notificationId\";s:2:\"32\";s:12:\"notification\";N;s:5:\"email\";N;s:11:\"description\";N;s:30:\"\0craft\\queue\\BaseJob\0_progress\";i:0;s:35:\"\0craft\\queue\\BaseJob\0_progressLabel\";N;}' WHERE `id`='92987'” /home/515761.cloudwaysapps.com/hfvcruqxmf/public_html/vendor/yiisoft/yii2/db/Schema.php:678
2021-11-25 02:10:15 [-][-][-][info][application] $_GET = []

The site never has any downtime, and server load is always low.

@engram-design
Copy link
Member

It must have something to do with the serialization of the submission when saving a sent notification I think, or potentially an infinite loop.

We might need to wait for #465 and #331 to get a copy of your form setup to see if I can replicate from that. Or, if you're able to sent through your craft_queue table to web at verbb.io I have a feeling it might be too large to handle.

@engram-design engram-design reopened this Nov 25, 2021
@Coysh
Copy link
Author

Coysh commented Nov 29, 2021

@engram-design - I only have one stuck item in the queue at the moment, but the same error is in the log.

Screenshot 2021-11-29 at 15 42 14

:

@engram-design
Copy link
Member

Yep, so Formie will try and create a serialization of the payload in the Job Data, but looks like it's not getting that far.

I would really need a copy of:

  • formie_forms with handle of yourFormHandle (whatever your form handle is)
  • formie_notifications with ID of 32
  • fmc_yourFormHandle with the ID of 74393

With that, I could hopefully replicate it, but I might still need your fields, which is tricky. If you can hold on, we might try the export feature in Formie 1.5.0 due in the next few weeks, which should be able to provide me everything I need to troubleshoot this one.

@Coysh
Copy link
Author

Coysh commented Nov 30, 2021

Hey @engram-design - hopefully these work, but let me know if it's easier for me to send you over a DB dump of the whole site?

INSERT INTO `craft_formie_forms` (`id`, `handle`, `fieldContentTable`, `settings`, `templateId`, `submitActionEntryId`, `requireUser`, `availability`, `availabilityFrom`, `availabilityTo`, `availabilitySubmissions`, `defaultStatusId`, `dataRetention`, `dataRetentionValue`, `userDeletedAction`, `fileUploadsAction`, `fieldLayoutId`, `dateCreated`, `dateUpdated`, `uid`)
VALUES
	(61517, 'newBusinessBriefingForm2', '{{%fmc_newbusinessbriefingform2}}', '{\"displayFormTitle\":\"\",\"displayCurrentPageTitle\":\"\",\"displayPageTabs\":\"\",\"displayPageProgress\":\"\",\"progressPosition\":\"end\",\"defaultLabelPosition\":\"verbb\\\\formie\\\\positions\\\\AboveInput\",\"defaultInstructionsPosition\":\"verbb\\\\formie\\\\positions\\\\AboveInput\",\"submitMethod\":\"page-reload\",\"submitAction\":\"message\",\"submitActionTab\":null,\"submitActionUrl\":\"\",\"submitActionFormHide\":\"\",\"submitActionMessage\":\"[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Submission saved.\\\"}]}]\",\"submitActionMessageTimeout\":\"\",\"submitActionMessagePosition\":\"top-form\",\"loadingIndicator\":\"\",\"loadingIndicatorText\":\"\",\"validationOnSubmit\":\"1\",\"validationOnFocus\":\"\",\"errorMessage\":\"[{\\\"type\\\":\\\"paragraph\\\",\\\"content\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Couldn’t save submission due to errors.\\\"}]}]\",\"errorMessagePosition\":\"top-form\",\"availabilityMessage\":null,\"availabilityMessageDate\":null,\"availabilityMessageSubmissions\":null,\"integrations\":{\"mailchimp\":{\"enabled\":\"\",\"optInField\":\"\",\"listId\":\"\",\"fieldMapping\":\"\",\"appendTags\":\"\",\"useDoubleOptIn\":\"\"},\"recaptcha\":{\"enabled\":\"\",\"showAllPages\":\"\"},\"honeypot\":{\"enabled\":\"\",\"showAllPages\":\"\"}},\"submissionTitleFormat\":\"{timestamp}\",\"collectIp\":\"\",\"collectUser\":\"\",\"dataRetention\":null,\"dataRetentionValue\":null,\"fileUploadsAction\":null,\"redirectUrl\":null,\"defaultEmailTemplateId\":\"\",\"storeData\":null,\"userDeletedAction\":null}', 1, NULL, 0, 'always', NULL, NULL, NULL, 1, 'forever', NULL, 'retain', 'retain', 71, '2021-10-12 16:23:20', '2021-11-24 12:26:10', 'f6c0a722-eb88-46f2-b075-561c3ec46a75');
INSERT INTO `craft_formie_notifications` (`id`, `formId`, `templateId`, `name`, `enabled`, `subject`, `to`, `cc`, `bcc`, `replyTo`, `replyToName`, `from`, `fromName`, `content`, `attachFiles`, `enableConditions`, `conditions`, `dateCreated`, `dateUpdated`, `uid`)
VALUES
	(32, 61517, NULL, 'Email', 1, 'New Business form', '[email protected], [email protected], [email protected]', NULL, NULL, NULL, NULL, NULL, NULL, '[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"A user submission has been made on \\\"New Business Briefing\\\" at \"},{\"type\":\"variableTag\",\"attrs\":{\"label\":\"Timestamp (yyyy-mm-dd hh:mm:ss)\",\"value\":\"{timestamp}\"}}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Their submission details are:\"}]},{\"type\":\"paragraph\",\"content\":[{\"type\":\"variableTag\",\"attrs\":{\"label\":\"All Form Fields\",\"value\":\"{allFields}\"}}]}]', 1, 0, '{\"sendRule\":\"send\",\"conditionRule\":\"all\",\"conditions\":[]}', '2021-10-12 16:33:07', '2021-11-24 12:26:10', '71fbd8f2-2ccd-450f-b00d-fd89d3128b5b');
INSERT INTO `craft_fmc_newbusinessbriefingform2` (`id`, `elementId`, `siteId`, `dateCreated`, `dateUpdated`, `uid`, `field_clientName_ryoaautv`, `field_clientContactLead_iwvjqzpr`, `field_clientEmailAddress_scocwgqt`, `field_activityType_gvltgafl`, `field_dateOfBrief_nfngdonv`, `field_estimatedBudget_osoneclr`, `field_backgroundInformation_qqmozqah`, `field_marketingSupport_qeooyqru`, `field_brandPositioningStatement_ylmjxppb`, `field_businessCharityObjectives_mmtdziqq`, `field_whatDoYouHopeToAchieveByEngagingJerseyRoadPr_xhyqzdox`, `field_prMessaging_oguuzshq`, `field_primary_hlfbqnvb`, `field_secondary_beubdkir`, `field_targetMedia_kpnrdhhs`, `field_keySpokespeople_qinfhcfm`, `field_brandAmbassadors_jkmlmyie`, `field_competition_uktecova`, `field_keyConsiderationsOrSensitivities_nyxtwfwq`)
VALUES
	(4, 74393, 2, '2021-11-25 12:13:47', '2021-11-25 12:13:47', '12a1774a-4334-4818-b760-cbef2c3a0efd', 'Tim Coysh', 'Tim', '[email protected]', 'Retainer', '2021-11-25 00:00:00', '', 'Test', '', '', 'Test', '', '', '', '', '', '', '', '', '');

@engram-design
Copy link
Member

Thanks! I'll give that a shot and we'll see how we go...

@Coysh
Copy link
Author

Coysh commented Dec 7, 2021

@engram-design - Thanks! Have you got any updates on this?

@engram-design
Copy link
Member

Sorry @Coysh I've been preoccupied with the 1.5.0 release, I'll do my best to look at this today.

@engram-design
Copy link
Member

@Coysh Okay, so it might be easier if you're up for sending your database in its entirety to web at verbb.io if that's possible?

@Coysh
Copy link
Author

Coysh commented Feb 3, 2022

Hi @engram-design - any update on this?
I've had the following error on these at the moment:
Screenshot 2022-02-03 at 12 35 59

@Coysh
Copy link
Author

Coysh commented Feb 3, 2022

Hey @engram-design - just as an update, this issue looks similar: yiisoft/yii2-queue#439
And I got this error running the queue manually:

$ ./craft queue/run
^CError: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: SELECT GET_LOCK('6308666b2496a1dc9724e644b98a4d744178264e', 3)

@engram-design
Copy link
Member

I just can't seem to replicate it which is frustrating. I think from memory I even got your database, spun it up, and couldn't replicate it?

I think my last email back to you was Are you able to let me know how you run your queue on your server? - is there any special with your setup? I imagine you run the queue via a daemon, or form the command line (as opposed to automatically which is the default)?

@Coysh
Copy link
Author

Coysh commented Feb 11, 2022

Hey Josh,

So I'm using the AsyncQueue plugin to run the queue

Tim

@engram-design
Copy link
Member

I've not used AsyncQueue extensively, but will check to see if there's anything that might be different.

@engram-design
Copy link
Member

So after extensively testing with AsyncQueue, I'm no further along this issue. I've also tested all your forms.

So that really leaves this as an environmental issue. Does this happen locally? Is there any chance of getting control panel and file-level access to your production site?

@engram-design
Copy link
Member

Going to close this as I really, really can't reproduce this, and no other reports have come in for this issue in the 6 months since this was opened.

If we want to get to the bottom of it, reach out via Discord @crawf and I'll need to get hands-on access with your environment, as this seems clearly environmental.

@engram-design engram-design closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants