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

"Database has gone away" error related to the storage of a photo #7140

Open
doweio opened this issue May 15, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@doweio
Copy link

commented May 15, 2019

Originally posted by @MrPetovan in #5787 (comment):

I keep having this specific error related to the storage of a photo:

Warning:  Error while sending STMT_EXECUTE packet. PID=9009 in src/Database/DBA.php on line 476
Stack trace:
  1. {main}() bin/worker.php:0
  2. Friendica\Core\Worker::processQueue() bin/worker.php:52
  3. Friendica\Core\Worker::execute() src/Core/Worker.php:102
  4. Friendica\Core\Worker::execFunction() src/Core/Worker.php:255
  5. call_user_func_array:{src/Core/Worker.php:365}() src/Core/Worker.php:365
  6. Friendica\Worker\Notifier::execute() src/Core/Worker.php:365
  7. Friendica\Model\Contact::terminateFriendship() src/Worker/Notifier.php:103
  8. Friendica\Protocol\OStatus::salmon() src/Model/Contact.php:553
  9. Friendica\Protocol\OStatus::entry() src/Protocol/OStatus.php:2238
 10. Friendica\Protocol\OStatus::followEntry() src/Protocol/OStatus.php:1563
 11. Friendica\Network\Probe::uri() src/Protocol/OStatus.php:1806
 12. Friendica\Protocol\ActivityPub::probeProfile() src/Network/Probe.php:339
 13. Friendica\Model\APContact::getByURL() src/Protocol/ActivityPub.php:88
 14. Friendica\Model\Contact::updateAvatar() src/Model/APContact.php:189
 15. Friendica\Model\Photo::importProfilePhoto() src/Model/Contact.php:1477
 16. Friendica\Model\Photo::store() src/Model/Photo.php:120
 17. Friendica\Database\DBA::insert() src/Model/Photo.php:79
 18. Friendica\Database\DBA::e() src/Database/DBA.php:853
 19. Friendica\Database\DBA::p() src/Database/DBA.php:621
 20. PDOStatement->execute() src/Database/DBA.php:476

--

I had a similar issue recently.

Apache's error log:

[Wed May 15 10:26:43.563226 2019] [proxy_fcgi:error] [pid 5513] [client xxx.xxx.xxx.xxx:45262] AH01071: Got error 'PHP message: PHP Warning:  Error while sending STMT_CLOSE packet. PID=5439 in /home/friendica/public_html/src/Database/DBA.php on line 625\n', referer: https://friendica.me/photos/bigsquishy/upload

Friendica's debug log:

2019-05-15 09:26:43 index [ERROR]: DB Error  - {"file":"DBA.php","line":684,"function":"e","uid":"e829ce","process_id":5439}
2019-05-15 09:26:43 index [ERROR]: DB Error {"code":2006,"error":"MySQL server has gone away","callstack":"DBA::update, DatabaseSessionHandler::write, session_write_close","params":"UPDATE `session` SET `data` = 'my_url|s:39:\\\"https:\/\/friendica.me\/profile\/bigsquishy\\\";my_address|s:23:\\\"bigsquishy@friendica.me\\\";addr|s:14:\\\"xxx.xxx.xxx.xxx\\\";new_member|b:0;last_login_date|s:19:\\\"2019-05-15 08:01:08\\\";last_updated|a:4:{s:12:\\\"profile:1:1:\\\";i:1557912146;s:11:\\\"profile::1:\\\";i:1557909921;s:14:\\\"profile:33:33:\\\";i:1557911347;s:14:\\\"profile:34:34:\\\";i:1557912282;}language|s:2:\\\"en\\\";network_last_top_limit|s:19:\\\"2019-05-15 08:50:37\\\";network_last_date|s:19:\\\"2019-05-15 08:50:37\\\";network_last_date_timestamp|i:1557910728;post-random|s:12:\\\"663190400060\\\";fastlane|s:37:\\\"https:\/\/mastodon.xyz\/users\/xxxxxxxx\\\";photo_return|s:24:\\\"photos\/bigsquishy\/upload\\\";uid|i:34;theme|s:0:\\\"\\\";mobile-theme|N;authenticated|i:1;page_flags|i:1;cid|i:3050;submanage|i:1;return_path|s:18:\\\"profile\/bigsquishy\\\";sysmsg_info|a:0:{}sysmsg|a:1:{i:0;s:28:\\\"Image upload failed.<br \/>\\r\\n\\\";}', `expire` = 1558092403 WHERE (`sid` = '58d2gv289od6ubrk0d067rg6a1' AND (`data` != 'my_url|s:39:\\\"https:\/\/friendica.me\/profile\/bigsquishy\\\";my_address|s:23:\\\"bigsquishy@friendica.me\\\";addr|s:14:\\\"xxx.xxx.xxx.xxx\\\";new_member|b:0;last_login_date|s:19:\\\"2019-05-15 08:01:08\\\";last_updated|a:4:{s:12:\\\"profile:1:1:\\\";i:1557912146;s:11:\\\"profile::1:\\\";i:1557909921;s:14:\\\"profile:33:33:\\\";i:1557911347;s:14:\\\"profile:34:34:\\\";i:1557912282;}language|s:2:\\\"en\\\";network_last_top_limit|s:19:\\\"2019-05-15 08:50:37\\\";network_last_date|s:19:\\\"2019-05-15 08:50:37\\\";network_last_date_timestamp|i:1557910728;post-random|s:12:\\\"663190400060\\\";fastlane|s:37:\\\"https:\/\/mastodon.xyz\/users\/xxxxxxxxxx\\\";photo_return|s:24:\\\"photos\/bigsquishy\/upload\\\";uid|i:34;theme|s:0:\\\"\\\";mobile-theme|N;authenticated|i:1;page_flags|i:1;cid|i:3050;submanage|i:1;return_path|s:18:\\\"profile\/bigsquishy\\\";sysmsg_info|a:0:{}sysmsg|a:1:{i:0;s:28:\\\"Image upload failed.<br \/>\\r\\n\\\";}' OR `expire` != 1558092403))"} - {"file":"DBA.php","line":684,"function":"e","uid":"e829ce","process_id":5439}

Running 2019.06-dev - 1310.

Turns out that there wasn't an issue uploading a smaller image, in a different account. On a hunch, I added the following to MySQL's config, at /etc/mysql/mariadb.conf.d/50-server.cnf:

max_allowed_packet = 4M

This worked. I could then upload the larger image (2.6MB) without the error triggering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.