craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 627 forks source link

Publishing a draft of table field causes internal server error #6122

Closed karltriest closed 4 years ago

karltriest commented 4 years ago

Description

making a draft of a table field then publishing that draft causes "An internal server error occurred."

Steps to reproduce

  1. enter data to a table row
  2. publish draft
  3. publish changes

*note: publishing the exact same data without first making a draft works fine

Additional info

Error Log

An Error occurred while handling another error:
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php:1293
Stack trace:
#0 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1293): PDOStatement->execute()
#1 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('SELECT *\nFROM `...')
#2 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(401): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /usr/share/nginx/vendor/yiisoft/yii2/db/Query.php(237): yii\db\Command->queryAll()
#4 /usr/share/nginx/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query->all(NULL)
#5 /usr/share/nginx/vendor/craftcms/cms/src/services/Categories.php(118): yii\db\ActiveQuery->all()
#6 /usr/share/nginx/vendor/craftcms/cms/src/services/Categories.php(135): craft\services\Categories->getAllGroups()
#7 /usr/share/nginx/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(360): craft\services\Categories->getEditableGroups()
#8 /usr/share/nginx/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(290): craft\web\assets\cp\CpAsset->_editableCategoryGroups()
#9 /usr/share/nginx/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(91): craft\web\assets\cp\CpAsset->_craftData()
#10 /usr/share/nginx/vendor/yiisoft/yii2/web/View.php(267): craft\web\assets\cp\CpAsset->registerAssetFiles(Object(craft\web\View))
#11 /usr/share/nginx/vendor/craftcms/cms/src/web/View.php(1771): yii\web\View->registerAssetFiles('craft\\web\\asset...')
#12 /usr/share/nginx/vendor/yiisoft/yii2/web/View.php(265): craft\web\View->registerAssetFiles('craft\\web\\asset...')
#13 /usr/share/nginx/vendor/craftcms/cms/src/web/View.php(1771): yii\web\View->registerAssetFiles('craft\\web\\asset...')
#14 /usr/share/nginx/vendor/yiisoft/yii2/web/View.php(163): craft\web\View->registerAssetFiles('craft\\web\\asset...')
#15 /usr/share/nginx/vendor/craftcms/cms/src/web/View.php(1059): yii\web\View->endBody()
#16 /usr/share/nginx/vendor/yiisoft/yii2/views/errorHandler/exception.php(538): craft\web\View->endBody()
#17 /usr/share/nginx/vendor/yiisoft/yii2/base/View.php(348): require('/usr/share/ngin...')
#18 /usr/share/nginx/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/usr/share/ngin...', Array)
#19 /usr/share/nginx/vendor/yiisoft/yii2/web/ErrorHandler.php(270): yii\base\View->renderFile('/usr/share/ngin...', Array, Object(craft\web\ErrorHandler))
#20 /usr/share/nginx/vendor/yiisoft/yii2/web/ErrorHandler.php(127): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#21 /usr/share/nginx/vendor/craftcms/cms/src/web/ErrorHandler.php(128): yii\web\ErrorHandler->renderException(Object(yii\db\Exception))
#22 /usr/share/nginx/vendor/yiisoft/yii2/base/ErrorHandler.php(123): craft\web\ErrorHandler->renderException(Object(yii\db\Exception))
#23 /usr/share/nginx/vendor/craftcms/cms/src/web/ErrorHandler.php(61): yii\base\ErrorHandler->handleException(Object(yii\db\Exception))
#24 [internal function]: craft\web\ErrorHandler->handleException(Object(yii\db\Exception))
#25 {main}

Next yii\db\Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: SELECT *
FROM `categorygroups`
WHERE `dateDeleted` IS NULL
ORDER BY `name` in /usr/share/nginx/vendor/yiisoft/yii2/db/Schema.php:674
Stack trace:
#0 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1298): yii\db\Schema->convertException(Object(PDOException), 'SELECT *\nFROM `...')
#1 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1159): yii\db\Command->internalExecute('SELECT *\nFROM `...')
#2 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(401): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /usr/share/nginx/vendor/yiisoft/yii2/db/Query.php(237): yii\db\Command->queryAll()
#4 /usr/share/nginx/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query->all(NULL)
#5 /usr/share/nginx/vendor/craftcms/cms/src/services/Categories.php(118): yii\db\ActiveQuery->all()
#6 /usr/share/nginx/vendor/craftcms/cms/src/services/Categories.php(135): craft\services\Categories->getAllGroups()
#7 /usr/share/nginx/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(360): craft\services\Categories->getEditableGroups()
#8 /usr/share/nginx/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(290): craft\web\assets\cp\CpAsset->_editableCategoryGroups()
#9 /usr/share/nginx/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(91): craft\web\assets\cp\CpAsset->_craftData()
#10 /usr/share/nginx/vendor/yiisoft/yii2/web/View.php(267): craft\web\assets\cp\CpAsset->registerAssetFiles(Object(craft\web\View))
#11 /usr/share/nginx/vendor/craftcms/cms/src/web/View.php(1771): yii\web\View->registerAssetFiles('craft\\web\\asset...')
#12 /usr/share/nginx/vendor/yiisoft/yii2/web/View.php(265): craft\web\View->registerAssetFiles('craft\\web\\asset...')
#13 /usr/share/nginx/vendor/craftcms/cms/src/web/View.php(1771): yii\web\View->registerAssetFiles('craft\\web\\asset...')
#14 /usr/share/nginx/vendor/yiisoft/yii2/web/View.php(163): craft\web\View->registerAssetFiles('craft\\web\\asset...')
#15 /usr/share/nginx/vendor/craftcms/cms/src/web/View.php(1059): yii\web\View->endBody()
#16 /usr/share/nginx/vendor/yiisoft/yii2/views/errorHandler/exception.php(538): craft\web\View->endBody()
#17 /usr/share/nginx/vendor/yiisoft/yii2/base/View.php(348): require('/usr/share/ngin...')
#18 /usr/share/nginx/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/usr/share/ngin...', Array)
#19 /usr/share/nginx/vendor/yiisoft/yii2/web/ErrorHandler.php(270): yii\base\View->renderFile('/usr/share/ngin...', Array, Object(craft\web\ErrorHandler))
#20 /usr/share/nginx/vendor/yiisoft/yii2/web/ErrorHandler.php(127): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#21 /usr/share/nginx/vendor/craftcms/cms/src/web/ErrorHandler.php(128): yii\web\ErrorHandler->renderException(Object(yii\db\Exception))
#22 /usr/share/nginx/vendor/yiisoft/yii2/base/ErrorHandler.php(123): craft\web\ErrorHandler->renderException(Object(yii\db\Exception))
#23 /usr/share/nginx/vendor/craftcms/cms/src/web/ErrorHandler.php(61): yii\base\ErrorHandler->handleException(Object(yii\db\Exception))
#24 [internal function]: craft\web\ErrorHandler->handleException(Object(yii\db\Exception))
#25 {main}
Additional Information:
Array
(
    [0] => HY000
    [1] => 2006
    [2] => MySQL server has gone away
)

Previous exception:
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php:1293
Stack trace:
#0 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1293): PDOStatement->execute()
#1 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1093): yii\db\Command->internalExecute('ROLLBACK TO SAV...')
#2 /usr/share/nginx/vendor/yiisoft/yii2/db/Schema.php(406): yii\db\Command->execute()
#3 /usr/share/nginx/vendor/craftcms/cms/src/db/mysql/Schema.php(108): yii\db\Schema->rollBackSavepoint('LEVEL1')
#4 /usr/share/nginx/vendor/yiisoft/yii2/db/Transaction.php(200): craft\db\mysql\Schema->rollBackSavepoint('LEVEL1')
#5 /usr/share/nginx/vendor/craftcms/cms/src/services/Elements.php(860): yii\db\Transaction->rollBack()
#6 /usr/share/nginx/vendor/craftcms/cms/src/services/Drafts.php(378): craft\services\Elements->duplicateElement(Object(craft\elements\Entry), '[<span class="s...')
#7 /usr/share/nginx/vendor/craftcms/cms/src/controllers/EntryRevisionsController.php(392): craft\services\Drafts->applyDraft(Object(craft\elements\Entry))
#8 [internal function]: craft\controllers\EntryRevisionsController->actionPublishDraft()
#9 /usr/share/nginx/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /usr/share/nginx/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 /usr/share/nginx/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('publish-draft', Array)
#12 /usr/share/nginx/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('publish-draft', Array)
#13 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('entry-revisions...', Array)
#14 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('entry-revisions...', Array)
#15 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#16 /usr/share/nginx/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /usr/share/nginx/html/index.php(46): yii\base\Application->run()
#18 {main}

Next yii\db\Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: ROLLBACK TO SAVEPOINT LEVEL1 in /usr/share/nginx/vendor/yiisoft/yii2/db/Schema.php:674
Stack trace:
#0 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1298): yii\db\Schema->convertException(Object(PDOException), 'ROLLBACK TO SAV...')
#1 /usr/share/nginx/vendor/yiisoft/yii2/db/Command.php(1093): yii\db\Command->internalExecute('ROLLBACK TO SAV...')
#2 /usr/share/nginx/vendor/yiisoft/yii2/db/Schema.php(406): yii\db\Command->execute()
#3 /usr/share/nginx/vendor/craftcms/cms/src/db/mysql/Schema.php(108): yii\db\Schema->rollBackSavepoint('LEVEL1')
#4 /usr/share/nginx/vendor/yiisoft/yii2/db/Transaction.php(200): craft\db\mysql\Schema->rollBackSavepoint('LEVEL1')
#5 /usr/share/nginx/vendor/craftcms/cms/src/services/Elements.php(860): yii\db\Transaction->rollBack()
#6 /usr/share/nginx/vendor/craftcms/cms/src/services/Drafts.php(378): craft\services\Elements->duplicateElement(Object(craft\elements\Entry), '[<span class="s...')
#7 /usr/share/nginx/vendor/craftcms/cms/src/controllers/EntryRevisionsController.php(392): craft\services\Drafts->applyDraft(Object(craft\elements\Entry))
#8 [internal function]: craft\controllers\EntryRevisionsController->actionPublishDraft()
#9 /usr/share/nginx/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /usr/share/nginx/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 /usr/share/nginx/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('publish-draft', Array)
#12 /usr/share/nginx/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('publish-draft', Array)
#13 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('entry-revisions...', Array)
#14 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('entry-revisions...', Array)
#15 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#16 /usr/share/nginx/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /usr/share/nginx/html/index.php(46): yii\base\Application->run()
#18 {main}
Additional Information:
Array
(
    [0] => HY000
    [1] => 2006
    [2] => MySQL server has gone away
)
karltriest commented 4 years ago

i get this error from the web.log:

2020-05-20 15:04:43 - error - yii\web\HttpException:400
yii\web\BadRequestHttpException: Unable to verify your data submission. in /usr/share/nginx/vendor/yiisoft/yii2/web/Controller.php:190
Stack trace:
#0 /usr/share/nginx/vendor/craftcms/cms/src/web/Controller.php(134): yii\web\Controller->beforeAction(Object(yii\base\InlineAction))
#1 /usr/share/nginx/vendor/craftcms/cms/src/controllers/TemplatesController.php(69): craft\web\Controller->beforeAction(Object(yii\base\InlineAction))
#2 /usr/share/nginx/vendor/yiisoft/yii2/base/Controller.php(155): craft\controllers\TemplatesController->beforeAction(Object(yii\base\InlineAction))
#3 /usr/share/nginx/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('render', Array)
#4 /usr/share/nginx/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('render', Array)
#5 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('templates/rende...', Array)
#6 /usr/share/nginx/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('templates/rende...', Array)
#7 /usr/share/nginx/vendor/craftcms/cms/src/web/Application.php(276): yii\web\Application->handleRequest(Object(craft\web\Request))
#8 /usr/share/nginx/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#9 /usr/share/nginx/html/index.php(48): yii\base\Application->run()
#10 {main}
angrybrad commented 4 years ago

@karltriest The MySQL docs have a whole page dedicated to that "MySQL server has gone away" message (https://dev.mysql.com/doc/refman/8.0/en/gone-away.html), but 9 times out of 10 when we see it, it's because you need to bump your MySQL server's max_allowed_packet and/or wait_timeout settings to higher values.

karltriest commented 4 years ago

@angrybrad I changed the MySQL options to max_allowed_packet to 67108864 (64MB), (default/was 4MB) supposedly the default for wait_timeout on mysql is 28800 (8 hours), so i don't think that was an issue but I added in 28800 just in case.

Unfortunately the bug persists.

angrybrad commented 4 years ago

@karltriest did you verify the settings took? i.e. SHOW VARIABLES LIKE '%max_allowed_packet%';

If they did, the other setting I've setting that works is bumping innodb_log_file_size higher.

karltriest commented 4 years ago

@angrybrad turns out that it was the max_allowed_packet setting, and the server needed a reboot in order for the setting to take. thanks! really appreciate your help

angrybrad commented 4 years ago

@karltriest glad you're all sorted!