inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.33k stars 782 forks source link

[BUG] Internal Server Error after update to stable 0.6.0 #2657

Closed BrentVerhaegen closed 2 years ago

BrentVerhaegen commented 2 years ago

Describe the bug After an update on the Stable channel of Docker to Inventree 0.6.0, the Inventree webpage shows Internal Server Error Tried restarting the server but no success.

Extra question Why is a new release getting pushed on the stable tag together with the latest tag? Shouldn't the stable tag trail behind latest a few weeks to ensure stable releases? I like the new features and improvements, but that the server keeps running smoothly is even more important than this :-)

Steps to Reproduce

Steps to reproduce the behavior: Upgrade from the last stable Inventree to Inventree 0.6.0

Screenshots image

Deployment Method

Version Information Can't access Inventree to get the Version Information. Server is down

Logs:

/home/inventree/data/config.yaml exists - skipping
InvenTree translation coverage: 15%
2022-02-21 04:18:11,081 WARNING Plugin configuration file does not exist
Waiting for database...
Database connection sucessful!
04:18:53 [Q] INFO Q Cluster early-sixteen-butter-michigan starting.
04:18:53 [Q] INFO Process-1:1 ready for work at 24
04:18:53 [Q] INFO Process-1:2 ready for work at 25
04:18:53 [Q] INFO Process-1:3 ready for work at 26
04:18:53 [Q] INFO Process-1:4 ready for work at 27
04:18:53 [Q] INFO Process-1:5 monitoring at 28
04:18:53 [Q] INFO Process-1 guarding cluster early-sixteen-butter-michigan
04:18:53 [Q] INFO Process-1:6 pushing tasks at 29
04:18:53 [Q] INFO Q Cluster early-sixteen-butter-michigan running.
04:19:23 [Q] INFO Enqueued 8802
04:19:23 [Q] INFO Process-1 created a task from schedule [InvenTree.tasks.delete_old_error_logs]
04:19:23 [Q] INFO Enqueued 8803
04:19:23 [Q] INFO Process-1 created a task from schedule [common.tasks.delete_old_notifications]
04:19:23 [Q] INFO Process-1:1 processing [spring-july-river-montana]
04:19:23 [Q] INFO Process-1:2 processing [alpha-alaska-robin-charlie]
/home/inventree/.local/lib/python3.8/site-packages/django/db/models/fields/__init__.py:1416: RuntimeWarning: DateTimeField NotificationEntry.updated received a naive datetime (2021-11-23 04:19:23.978031) while time zone support is active.
  warnings.warn("DateTimeField %s received a naive datetime (%s)"
04:19:24 [Q] ERROR Failed [alpha-alaska-robin-charlie] - relation "common_notificationentry" does not exist
LINE 1: ...."uid", "common_notificationentry"."updated" FROM "common_no...
                                                             ^
 : Traceback (most recent call last):
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "common_notificationentry" does not exist
LINE 1: ...."uid", "common_notificationentry"."updated" FROM "common_no...
                                                             ^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/inventree/.local/lib/python3.8/site-packages/django_q/cluster.py", line 436, in worker
    res = f(*task["args"], **task["kwargs"])
  File "/home/inventree/InvenTree/common/tasks.py", line 29, in delete_old_notifications
    NotificationEntry.objects.filter(updated__lte=before).delete()
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/models/query.py", line 745, in delete
    collector.collect(del_query)
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/models/deletion.py", line 243, in collect
    new_objs = self.add(objs, source, nullable,
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/models/deletion.py", line 107, in add
    if not objs:
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/models/query.py", line 284, in __bool__
    self._fetch_all()
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    cursor.execute(sql, params)
  File "/home/inventree/.local/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/inventree/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/inventree/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/inventree/.local/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/inventree/.local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "common_notificationentry" does not exist
LINE 1: ...."uid", "common_notificationentry"."updated" FROM "common_no...
                                                             ^
github-actions[bot] commented 2 years ago

Welcome to InvenTree! Please check the contributing docs on how to help.\nIf you experience setup / install issues please read all install docs.

SchrodingersGat commented 2 years ago

@BrentVerhaegen did you run invoke update? It looks like some of the new database migrations have not been made.

Either:

Can you step through the process you followed here for the update?

Extra question Why is a new release getting pushed on the stable tag together with the latest tag? Shouldn't the stable tag trail behind latest a few weeks to ensure stable releases? I like the new features and improvements, but that the server keeps running smoothly is even more important than this :-)

The latest tag represents the most recent code commit. The stable tag represents a commit we consider "stable". As the stable 0.6.0 version was just released to day, it is almost identical to the latest code, as we were in a feature freeze.

You can see here all the issues we closed out on our way to our stable release.

BrentVerhaegen commented 2 years ago

@SchrodingersGat Thanks for your swift reply. I indeed didn't follow the docker update instructions. My containers get automatically upgraded by Watchtower, and I wasn't aware of the update instructions. Running invoke upgrade solved the issue and the server is running and accessible again. Thank you

SchrodingersGat commented 2 years ago

Glad to hear it! Thanks for reporting the fix :)