Wikimedia Developer Support

Database connection closing during importDump.php

I posted this on the general support desk page but then saw this site, so I am reposting here.

Hello, I am consistently but sporadically having this problem on an instance of mediawiki I am hosting offline. Because it’s an offline system I can’t provide an in depth stack trace but I’ll try my best.

I am trying to mirror Wikipedia with mediawiki-v1.34.1 in a few different languages such as English and Arabic and while running the importDump.php maintenance script on my XML dumps it randomly gets interrupted with the error:

Wikimedia\Rdbms\DBUnexpectedError from line 956 of /var/www/html/mediawiki-1.34.1/includes/libs/rdbms/database/Database.php: DB connection was already closed

It takes quite a while to go through the Wikipedia dumps as they’re pretty huge, so this problem is making it very slow and hard to get through them as I can’t leave the script running for longer than 30 minutes before this error occurs and stops it.

This is the line I am using to run it:

sudo php importDump.php --conf …/LocalSettings.php /var/www/html/arwiki-latest-pages-articles.xml.bz2 --dbuser root --debug --username-prefix=""

I couldn’t find this problem anywhere online, does anyone know how to help with it?

Hi and welcome! Do you develop code and is this a development question? Looks like a support request to me?

First step is probably to get a full stack trace. See how to debug.