danbider / lightning-pose

Accelerated pose estimation and tracking using semi-supervised convolutional networks.
MIT License
235 stars 34 forks source link

Issue: Runtime error database disk image is malformed #101

Closed MichaelGMoore closed 1 year ago

MichaelGMoore commented 1 year ago

We have run into this issue twice now.

We are running ~/Pose-app/app.py to run lightning pose.

It seems like something gets messed up in sqlite. The problem is we haven't been able to clear the error. We only solved this the first time with a complete re-install.

If you understand how to reset this database to somehow get lightning-pose going again, that would be helpful.

We tried removing and re-installing ~/venv-label-studio, but that did not fix the problem.

Here is the graphical output from app.py:

Runtime error database disk image is malformed

Traceback (most recent call last): File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute return Database.Cursor.execute(self, query, params) sqlite3.DatabaseError: database disk image is malformed

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, kwargs) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, *kwargs) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/label_studio/projects/api.py", line 165, in get return super(ProjectListAPI, self).get(request, args, kwargs) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/rest_framework/generics.py", line 239, in get return self.list(request, *args, **kwargs) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/rest_framework/mixins.py", line 40, in list page = self.paginate_queryset(queryset) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/rest_framework/generics.py", line 171, in paginate_queryset return self.paginator.paginate_queryset(queryset, self.request, view=self) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/rest_framework/pagination.py", line 204, in paginate_queryset self.page = paginator.page(page_number) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/core/paginator.py", line 76, in page number = self.validate_number(number) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/core/paginator.py", line 54, in validate_number if number > self.num_pages: File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/utils/functional.py", line 48, in get res = instance.dict[self.name] = self.func(instance) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/core/paginator.py", line 103, in num_pages if self.count == 0 and not self.allow_empty_first_page: File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/utils/functional.py", line 48, in get res = instance.dict[self.name] = self.func(instance) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/core/paginator.py", line 97, in count return c() File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/models/query.py", line 412, in count return self.query.get_count(using=self.db) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/models/sql/query.py", line 528, in get_count number = obj.get_aggregation(using, ['count'])['count'] File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/models/sql/query.py", line 513, in get_aggregation result = compiler.execute_sql(SINGLE) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql cursor.execute(sql, params) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/sentry_sdk/integrations/django/init.py", line 596, in execute return real_execute(self, sql, params) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers return executor(sql, params, many, context) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/home/plafave/venv-label-studio/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute return Database.Cursor.execute(self, query, params) django.db.utils.DatabaseError: database disk image is malformed

themattinthehatt commented 1 year ago

You can delete the labelstudio database by deleting the following directories:

This will, unfortunately, delete your labeled data that is stored in the labelstudio database; however the labels will still be available in the CollectedData.csv file. If this is an issue for you, one of the items on my todo list is to initialize a labelstudio project using a directory of frames and a csv file of labels. I can bump the priority of this up if it is immediately helpful for you.

Do you have any additional info on how you've gotten this error in the past? Is it while using a particular part of the app? Anything to help reproduce the error would be helpful.

themattinthehatt commented 1 year ago

@MichaelGMoore actually would you mind opening this issue in the Pose-app repo? https://github.com/Lightning-Universe/Pose-app/issues

MichaelGMoore commented 1 year ago

I opened the issue in the Poss-app repo as requested.

This bug appeared twice. The first time, it was when the student tried to change the list of body-parts for an already existing project, and the second time was when the student left the project open over night at some middle-stage in the pipeline, and tried to continue working on the project the next day. This is my why main concern was how to restore the app to working condition if/when this happens. I will try just removing the .db files you suggested and let you know how it goes, but I will do it over in the pose-app repo.