Confirmed CLI:xf-import aborts with DB error when using --processes

Kirby

Well-known member
Affected version
2.1.2
MySQL server has gone away:

Code:
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] mys...', '/var/www/vhosts...', 35, Array)
#1 src/XF/Db/Mysqli/Statement.php(35): mysqli->prepare('SELECT MAX(comm...')
#2 src/XF/Db/Mysqli/Statement.php(54): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(150): XF\Db\AbstractAdapter->query('SELECT MAX(comm...', Array)
#5 src/addons/XFMG/Import/Importer/vBulletinAlbums4.php(89): XF\Db\AbstractAdapter->fetchOne('SELECT MAX(comm...')
#6 src/XF/Import/Runner.php(197): XFMG\Import\Importer\vBulletinAlbums4->getStepEndComments()
#7 src/XF/Import/Runner.php(81): XF\Import\Runner->setupRunnableStep()
#8 src/XF/Import/ParallelRunner.php(20): XF\Import\Runner->initializeRun()
#9 src/XF/Import/Runner.php(128): XF\Import\ParallelRunner->runUntilCompleteInternal(Object(XF\Import\Manager), Object(Closure))
#10 src/XF/Cli/Command/Import.php(144): XF\Import\Runner->runUntilComplete(Object(XF\Import\Manager), Object(Closure))
#11 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\Import->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 src/vendor/symfony/console/Application.php(960): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\Import), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 src/XF/Cli/Runner.php(63): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 cmd.php(15): XF\Cli\Runner->run()
#17 {main}

Code:
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] mys...', '/var/www/vhosts...', 35, Array)
#1 src/XF/Db/Mysqli/Statement.php(35): mysqli->prepare('SELECT MAX(comm...')
#2 src/XF/Db/Mysqli/Statement.php(54): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(150): XF\Db\AbstractAdapter->query('SELECT MAX(comm...', Array)
#5 src/addons/XFMG/Import/Importer/vBulletinAlbums4.php(89): XF\Db\AbstractAdapter->fetchOne('SELECT MAX(comm...')
#6 src/XF/Import/Runner.php(197): XFMG\Import\Importer\vBulletinAlbums4->getStepEndComments()
#7 src/XF/Import/Runner.php(81): XF\Import\Runner->setupRunnableStep()
#8 src/XF/Import/ParallelRunner.php(20): XF\Import\Runner->initializeRun()
#9 src/XF/Import/Runner.php(128): XF\Import\ParallelRunner->runUntilCompleteInternal(Object(XF\Import\Manager), Object(Closure))
#10 src/XF/Cli/Command/Import.php(144): XF\Import\Runner->runUntilComplete(Object(XF\Import\Manager), Object(Closure))
#11 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\Import->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 src/vendor/symfony/console/Application.php(960): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\Import), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 src/XF/Cli/Runner.php(63): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 cmd.php(15): XF\Cli\Runner->run()
#17 {main}

This apparently does happen as the code does expect that a database connection will always be there after it has been established.
This might not be the case in the main process if a step does take longer than wait_timeout.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.0 RC3).

Change log:
Reset MySQL's wait_timeout when doing CLI imports to avoid a possible timeout
There may be a delay before changes are rolled out to the XenForo Community.
 
Hmm, I just got that error with XFI 1.5.1 / XF 2.2.7 PL 1

XF\Db\Exception: MySQL statement prepare error [2006]: MySQL server has gone away src/XF/Db/AbstractStatement.php:230
Code:
#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL statement...', 2006, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(41): XF\Db\Mysqli\Statement->getException('MySQL statement...', 2006, 'HY000')
#2 src/XF/Db/Mysqli/Statement.php(56): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(152): XF\Db\AbstractAdapter->query('
            SELECT MAX(...', Array)
#5 src/addons/XFI/Import/Importer/vBulletin.php(3637): XF\Db\AbstractAdapter->fetchOne('
            SELECT MAX(...')
#6 src/XF/Import/Runner.php(210): XFI\Import\Importer\vBulletin->getStepEndPostEditHistory()
#7 src/XF/Import/Runner.php(83): XF\Import\Runner->setupRunnableStep()
#8 src/XF/Import/ParallelRunner.php(21): XF\Import\Runner->initializeRun()
#9 src/XF/Import/Runner.php(130): XF\Import\ParallelRunner->runUntilCompleteInternal(Object(XF\Import\Manager), Object(Closure))
#10 src/XF/Cli/Command/Import.php(156): XF\Import\Runner->runUntilComplete(Object(XF\Import\Manager), Object(Closure))
#11 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\Import->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 src/vendor/symfony/console/Application.php(992): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\Import), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 src/XF/Cli/Runner.php(111): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 cmd.php(15): XF\Cli\Runner->run()
#17 {main}

As far as I can see, wait_timeout does get increased for the XenForo DB connection, but it does not seem to be increased as well for the source DB connection which is used within the watcher process to get lower/upper ID boundaries for each import step?
 
Last edited:
* bump *

This is still happening with XFI 1.5.2 / XF 2.2.13

---
  • XF\Db\Exception: MySQL statement prepare error [2006]: MySQL server has gone away
  • src/XF/Db/AbstractStatement.php:230
  • Generiert von: Unbekanntes Konto
  • 23.03.2024 um 13:32

Stack-Trace​

SELECT MAX(reputationid)
FROM reputation
WHERE reputation > 0

------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL statement...', 2006, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(41): XF\Db\Mysqli\Statement->getException('MySQL statement...', 2006, 'HY000')
#2 src/XF/Db/Mysqli/Statement.php(56): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(152): XF\Db\AbstractAdapter->query('
SELECT MAX(...', Array)
#5 src/addons/XFI/Import/Importer/vBulletin.php(4046): XF\Db\AbstractAdapter->fetchOne('
SELECT MAX(...')
#6 src/XF/Import/Runner.php(210): XFI\Import\Importer\vBulletin->getStepEndReputation()
#7 src/XF/Import/Runner.php(83): XF\Import\Runner->setupRunnableStep()
#8 src/XF/Import/ParallelRunner.php(21): XF\Import\Runner->initializeRun()
#9 src/XF/Import/Runner.php(130): XF\Import\ParallelRunner->runUntilCompleteInternal(Object(XF\Import\Manager), Object(Closure))
#10 src/XF/Cli/Command/Import.php(156): XF\Import\Runner->runUntilComplete(Object(XF\Import\Manager), Object(Closure))
#11 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\Import->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 src/vendor/symfony/console/Application.php(992): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\Import), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 src/XF/Cli/Runner.php(111): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 cmd.php(15): XF\Cli\Runner->run()
#17 {main}
---
 
Back
Top Bottom