Bug 7363

Summary: Building in managed mode locks the database
Product: [Build System, Metadata & Runtime] Toaster Reporter: Mihail Stanciu <stanciux.mihail>
Component: toasterAssignee: Alexandru Damian <alexandru.damian>
Status: VERIFIED FIXED QA Contact: Alexandru Roman <alexandru.costinx.roman>
Severity: critical    
Priority: Undecided CC: alexandru.costinx.roman, alexandru.damian, belen.barros.pena, cristiana.voicu, jessica.zhang
Version: 1.8   
Target Milestone: 1.8 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)

Description Mihail Stanciu 2015-02-25 14:21:57 UTC
Tested on: 40d80f9e019118ac7bcd268f21e350bc154a4a63

Steps to reproduce:
1. start toaster in managed mode
2. create a new project using local yocto clone
3. build core-image-minimal

Expected result:
Image build starts and is registered normally in toaster

Observed result:
The database becomes locked and the build cannot be completed.
Comment 1 Mihail Stanciu 2015-02-25 14:22:08 UTC
Traceback (most recent call last):
  File "bitbake/bin/../lib/toaster/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "/home/dave/poky/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py", line 132, in handle_noargs
    self.cleanup()
  File "/home/dave/poky/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py", line 128, in cleanup
    BuildEnvironment.objects.filter(lock=BuildEnvironment.LOCK_LOCK).filter(updated__lt = timezone.now() - timedelta(seconds = 30)).update(lock = BuildEnvironment.LOCK_FREE)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 490, in update
    rows = query.get_compiler(self.db).execute_sql(None)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 975, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 781, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 69, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 450, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: database is locked
Comment 2 Alexandru Damian 2015-02-26 21:46:52 UTC
Pushed for review on bitbake-devel mail list.
Comment 3 Alexandru Damian 2015-02-27 11:56:49 UTC
Merged into master.
Comment 4 Alexandru Roman 2015-11-27 12:51:29 UTC
Verified.