Bug 8277 - OperationalError when viewing "command line builds" project while build is running
Summary: OperationalError when viewing "command line builds" project while build is ru...
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 2.0
Hardware: x86 x86_64
: Medium normal
Target Milestone: 2.0
Assignee: Elliot Smith
QA Contact: Alexandru Roman
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-09-10 12:42 UTC by Elliot Smith
Modified: 2015-11-06 08:58 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
OperationalError screenshot (447.47 KB, image/png)
2015-09-10 12:42 UTC, Elliot Smith
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elliot Smith 2015-09-10 12:42:31 UTC
Created attachment 2721 [details]
OperationalError screenshot

If you navigate to the "command line builds" project page while a command line build is in progress, an OperationalError is thrown (see screenshot).

Tested in analysis mode on poky master @ d4585fa23d56a58c583ee33db067a23177a936b1

To reproduce:

1. Set up toaster environment as described in the manual: steps 1-3 of  http://www.yoctoproject.org/docs/1.8/toaster-manual/toaster-manual.html#using-toaster-in-analysis-mode
2. Start toaster in analysis mode from the command line: source toaster start
3. Start a bitbake build from the same command line, e.g. bitbake busybox
4. Open toaster at the project page for the "command line builds" project: http://localhost:8000/toastergui/project/1/
(The build started in 3 should still be running when you try this.)

Note that the project URL may differ if the default project was added to your database after you had created other projects in build mode, or if you migrated from an old database structure to the new one (where the default project ID changed from 0. You can also find it by navigating to the all projects page (http://localhost:8000/toastergui/projects/) then selecting the "command line builds" project. If you use this approach, bear in mind that the "command line builds" project is not displayed until at least one build has been completed.

Expected:

List of command line builds displayed.

Actual:

OperationalError with the following traceback:

Environment:


Request Method: GET
Request URL: http://localhost:8000/toastergui/project/1/

Django Version: 1.6
Python Version: 2.7.5
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.messages',
 'django.contrib.sessions',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'bldcollector',
 'toastermain',
 'south',
 'orm',
 'bldcontrol',
 'toastergui')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ell/dev/toaster/poky-contrib/bitbake/lib/toaster/toastergui/views.py" in returned_wrapper
  150.                 context = view(request, *args, **kwargs)
File "/home/ell/dev/toaster/poky-contrib/bitbake/lib/toaster/toastergui/views.py" in project
  2232.             "builds" : _project_recent_build_list(prj),
File "/home/ell/dev/toaster/poky-contrib/bitbake/lib/toaster/toastergui/views.py" in _project_recent_build_list
  93.             "status": x.get_current_status(),
File "/home/ell/dev/toaster/poky-contrib/bitbake/lib/toaster/orm/models.py" in get_current_status
  354.         if self.outcome == Build.IN_PROGRESS and self.buildrequest.state != BuildRequest.REQ_INPROGRESS:
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/models/fields/related.py" in __get__
  197.                     rel_obj = self.get_queryset(instance=instance).get(**params)
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/models/query.py" in get
  301.         num = len(clone)
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/models/query.py" in __len__
  77.         self._fetch_all()
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  854.             self._result_cache = list(self.iterator())
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  220.         for row in compiler.results_iter():
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
  710.         for rows in self.execute_sql(MULTI):
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  781.         cursor.execute(sql, params)
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  69.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/home/ell/toaster-run/toaster-env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
  450.         return Database.Cursor.execute(self, query, params)

Exception Type: OperationalError at /toastergui/project/1/
Exception Value: no such table: bldcontrol_buildrequest
Comment 1 Elliot Smith 2015-09-10 12:45:55 UTC
NB may be related to #8186

Also note that the error is probably caused by the project page attempting to look up/use build request data, when the build request table only exists when toaster is started in managed mode. I was using a clean db for the tests which had never been started in managed mode, only in analysis mode.
Comment 2 Elliot Smith 2015-09-29 15:07:16 UTC
Submitted to toaster mailing list:
https://lists.yoctoproject.org/pipermail/toaster/2015-September/002782.html
Comment 3 Elliot Smith 2015-10-14 14:23:57 UTC
Michael submitted this to bitbake-devel:
http://lists.openembedded.org/pipermail/bitbake-devel/2015-October/006559.html
Comment 4 Elliot Smith 2015-10-16 14:10:06 UTC
Now in bitbake master.
Comment 5 Alexandru Roman 2015-11-06 08:58:00 UTC
Verified on master: fc45deac89ef63ca1c44e763c38ced7dfd72cbe1