fermentrack: Fermentrack frequently fails to load properly, warns that "Another isntance of BrewPi is already running ... This instance will exit"

Fermentrack frequently fails to load properly. I put together a new Raspberry Pi 3B the other day and setup Fermentrack. More often than not, it loads with the message Cannot receiveLCD text fromController/Script.

Here is the controller’s stderr log from the latest attempt:

 Jun 01 2023 17:03:41   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:04:21   Refreshing dbConfig
 Jun 01 2023 17:04:21   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:04:31   Refreshing dbConfig
 Jun 01 2023 17:04:31   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:04:42   Refreshing dbConfig
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/django/__init__.py", line 579, in connect
    return real_connect(self)
  File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 197, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 185, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  the database system is shutting down


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

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/app/brewpi-script/brewpi.py", line 159, in <module>
    dbConfig = refresh_dbConfig()
  File "/app/brewpi-script/brewpi.py", line 109, in refresh_dbConfig
    return models.BrewPiDevice.objects.get(id=device_id)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 411, in get
    num = len(clone)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 258, in __len__
    self._fetch_all()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1261, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 57, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1152, in execute_sql
    cursor = self.connection.cursor()
  File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 260, in cursor
    return self._cursor()
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 236, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/django/__init__.py", line 579, in connect
    return real_connect(self)
  File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 197, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 185, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL:  the database system is shutting down

Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
 Jun 01 2023 17:06:10   Refreshing dbConfig
 Jun 01 2023 17:06:10   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:06:19   Refreshing dbConfig
 Jun 01 2023 17:06:19   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:06:29   Refreshing dbConfig
 Jun 01 2023 17:06:29   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:06:38   Refreshing dbConfig
 Jun 01 2023 17:06:38   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:06:48   Refreshing dbConfig
 Jun 01 2023 17:06:49   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:06:58   Refreshing dbConfig
 Jun 01 2023 17:06:59   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:07:08   Refreshing dbConfig
 Jun 01 2023 17:07:09   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:07:19   Refreshing dbConfig
 Jun 01 2023 17:07:19   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:07:29   Refreshing dbConfig
 Jun 01 2023 17:07:29   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:07:39   Refreshing dbConfig
 Jun 01 2023 17:07:39   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit
 Jun 01 2023 17:07:49   Refreshing dbConfig
 Jun 01 2023 17:07:49   Another instance of BrewPi is already running, which will conflict with this instance. This instance will exit

As far as I know I don’t have any other instances of BrewPi or Fermentrack set up. The Pi is dedicated as a fermentation chamber controller and has no other use.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 26 (22 by maintainers)

Most upvoted comments

I’m busy for the next few weeks plus my ferm chamber is busy lagering, so I’ll wait for the master update.

Hah - that makes me feel a lot better, actually. Don’t worry about reenabling it - I’m going to need to run tests on my side regardless.

In your nginx.conf what port do you have listed for the HTTPS redirect? 8123 or 5000?

I think your PR had it as 8123 which was the correct port with Circus – for this branch, it now needs to be 5000.

I can assist if you want me to test anything. I can always pull and spin up a second stable instance when I begin my brew this coming weekend if there are issues. Currently it’s functioning fine otherwise and I just down and up the containers if it acts up.