Problems with running the migrations
Categories
(Tree Management :: Treeherder, defect)
Tracking
(Not tracked)
People
(Reporter: igoldan, Unassigned)
References
Details
I'm having issues running my docker environment locally. I want to run Treeherder in fullstack mode, so I've followed the steps mentioned here.
I ran docker-compose up --build, which suspiciouslly logged this for the mysql machine:
mysql | Initializing database
mysql | Database initialized
mysql | Initializing certificates
mysql | Generating a RSA private key
mysql | ..............................+++++
mysql | ...........................+++++
mysql | unable to write 'random state'
mysql | writing new private key to 'ca-key.pem'
mysql | -----
mysql | Generating a RSA private key
mysql | ......................+++++
mysql | ...+++++
mysql | unable to write 'random state'
mysql | writing new private key to 'server-key.pem'
mysql | -----
mysql | Generating a RSA private key
mysql | ....................................+++++
mysql | ......................................+++++
mysql | unable to write 'random state'
mysql | writing new private key to 'client-key.pem'
mysql | -----
mysql | Certificates initialized
mysql | MySQL init process in progress...
mysql | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
mysql | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
mysql | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
mysql | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
mysql |
mysql |
mysql | MySQL init process done. Ready for start up.
mysql |
Then I ran docker-compose run backend sh -c "./initialize_data.sh", which always fails with this Python stacktrace:
Starting mysql ... done
Starting redis ... done
Starting rabbitmq ... done
-----> Running Django migrations and loading reference data
/usr/local/lib/python3.7/site-packages/rest_framework/exceptions.py:18: DeprecationWarning: 'version' is deprecated.
Use '__version__' instead.
from rest_framework.compat import unicode_to_repr
Operations to perform:
Apply all migrations: auth, contenttypes, model, perf, seta
Running migrations:
No migrations to apply.
/usr/local/lib/python3.7/site-packages/rest_framework/exceptions.py:18: DeprecationWarning: 'version' is deprecated.
Use '__version__' instead.
from rest_framework.compat import unicode_to_repr
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 312, in _query
db.query(q)
File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 224, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1213, 'Deadlock found when trying to get lock; try restarting transaction')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 34, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command
_line
utility.execute()
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/app/treeherder/model/management/commands/load_initial_data.py", line 15, in handle
'performance_bug_templates')
File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 148, in call_command
return command.execute(*args, **defaults)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/loaddata.py", line 114, in loaddata
self.load_label(fixture_label)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/loaddata.py", line 181, in load_label
obj.save(using=self.using)
File "/usr/local/lib/python3.7/site-packages/django/core/serializers/base.py", line 223, in save
models.Model.save_base(self.object, using=using, raw=True, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 779, in save_base
force_update, using, update_fields,
File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 851, in _save_table
forced_update)
File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 900, in _do_update
return filtered._update(values) > 0
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 760, in _update
return query.get_compiler(self.db).execute_sql(CURSOR)
File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1429, in execute_sql
cursor = super().execute_sql(result_type)
File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 99, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/usr/local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 312, in _query
db.query(q)
File "/usr/local/lib/python3.7/site-packages/MySQLdb/connections.py", line 224, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: Problem installing fixture '/app/treeherder/model/fixtures/failure_classification.j
son': Could not load model.FailureClassification(pk=1): (1213, 'Deadlock found when trying to get lock; try restartin
g transaction')
I'm using a Windows 10 operating system and a stable version of Docker.
| Reporter | ||
Comment 1•7 years ago
|
||
Cameron, Sarah are you also experiencing these problems?
Comment 2•6 years ago
|
||
I just tried docker-compose up --build locally with the DB defaulting to my local instance. Everything went through fine. I don't know what might be causing this. I suppose starting with a docker-compose down to clear things out. Then restart your machine and try again.
Updated•6 years ago
|
| Reporter | ||
Comment 3•6 years ago
|
||
(In reply to Cameron Dawson [:camd] from comment #2)
I just tried
docker-compose up --buildlocally with the DB defaulting to my local instance. Everything went through fine. I don't know what might be causing this. I suppose starting with adocker-compose downto clear things out. Then restart your machine and try again.
Thanks for sharing this trick. I'm closing this ticket as invalid, as I seem to have resolved the issue. I think I simply forgot to clean up the .env file.
| Assignee | ||
Updated•4 years ago
|
Description
•