Tutor local launch on pi5 fails with MySQLdb.OperationalError: (2013, 'Lost connection to MySQL server during query')

Raspberry pi 5 4GB, 128GB SSD, running Raspberry Pi OS Lite.
Trying from a clean install after setting up docker, and pipx’ing in tutor.

Applying blackboard.0014_auto_20230105_2122...Traceback (most recent call last):
  File "/openedx/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.11/site-packages/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/openedx/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/openedx/venv/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
  File "/openedx/venv/lib/python3.11/site-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (2013, 'Lost connection to MySQL server during query')
The above exception was the direct cause of the following exception:

A retry gets to this different message which points to a half-run migration.

django.db.utils.OperationalError: (1060, "Duplicate column name 'last_content_sync_attempted_at'")

So I wiped it, and started again, and got back to the connection lost error again.

Any ideas?

Is it possible that MySQL is getting killed because your system is running out of free memory?

That is a possibility, I will try again and keep an eye on memory and let you know.

Thanks. FWIW, I tried (unsuccessfully) to our stack running on my 2 GB Pi 4 at one point. Our stack is pretty memory hungry at the moment. We’re working on various things that will make it slimmer, like:

  • The forums migration will remove the Ruby cs_comments_service and one of the two usages of MongoDB (this should be kicking off shortly).
  • Replacing Elasticsearch with something lighter in the default stack (even if we end up keeping support for ES as an option) will also significantly reduce memory requirements.
  • The Learning Core work will eventually get rid of the rest of MongoDB, though that’s further off. (The first usage of Learning Core is for the libraries relaunch happening for Sumac.)

So we are definitely aware that our platform is too heavy and are taking steps, but these changes will take some time to roll out in a way that offers people a smooth migration path.

1 Like

Thanks @dave !

This pointed the way to the solution, which was: to increase the swap from 200MB (!?) to 2048MB (I initially tried 4096, but the config max was 2048, so I gave that a try before figuring out how to increase it further).

So in total I had 4GB RAM + 2GB swap = 6GB, and it successfully ran through all the migrations and I’m currently grinning and looking at the screen saying:

Welcome to pi5 Open edX
It works! Powered by the Open edX® Platform


1 Like