Trying to understand your setup

1. You have many instances of weewx running simultaneously.
2. They all get backed up every day.
3. One of them, weewx_wbx1, crashes about once a month during the backup.
4. What version of WeeWX?

I don't attach any significance to the three different nested exceptions:
that's how the stack would normally get unwound from a database exception.
However, I don't understand the last one: dbmanager.addRecord(). By itself,
this does not lock the database. Is there more to the log? Something below
where you cut it off?

Depending on the answer to that, we may have to retry the transaction.
Right now, there is only one attempt.

-tk



On Sat, May 1, 2021 at 4:58 AM Luc Heijst <[email protected]> wrote:

> Once a day my weewx MySQL databases are backupped, see log of the backup
> below.
> The weewx programs are not stopped during these backups.
> One weewx program (weewx_wbx1) crashes once in a wile (once per month)
> with a number of deadlock found messages.
>
> It looks like weewx gets two more nested deadlock errors before a retry
> could be invoked.
>
> Any solutions?
>
> Backup log:
> =========================================
> Taak: mysql_backup
> Starttijd: Sat, 01 May 2021 03:00:02 GMT
> Stoptijd: Sat, 01 May 2021 03:21:38 GMT
> Huidige status: 0 (Normaal)
> Standaard uitvoer/fout:
> 2021-05-01 03:00:03 start
> 2021-05-01 03:00:03 cmon11
> 2021-05-01 03:00:10 cmon21
> 2021-05-01 03:00:27 cmon31
> 2021-05-01 03:02:31 cmon32
> 2021-05-01 03:02:37 cmon33
> 2021-05-01 03:02:48 cmon34
> 2021-05-01 03:03:05 cmon35
> 2021-05-01 03:03:22 cmon36
> 2021-05-01 03:03:49 cmon37
> 2021-05-01 03:04:09 cmon41
> 2021-05-01 03:04:12 cmon42
> 2021-05-01 03:04:15 lightning
> 2021-05-01 03:04:15 mbemdevices
> 2021-05-01 03:05:51 weewx_klim
> 2021-05-01 03:07:45 weewx_mbem
> 2021-05-01 03:14:26 weewx_mstk
> 2021-05-01 03:17:18 weewx_rtld
> 2021-05-01 03:18:03 weewx_tfrc
> 2021-05-01 03:18:26 weewx_vpro
> 2021-05-01 03:20:06 weewx_wamo
> 2021-05-01 03:20:40 weewx_wamodevices
> 2021-05-01 03:21:21 weewx_wbx1
> 2021-05-01 03:21:37 finished
>
> weewx error log:
> =========================================
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__: Caught unrecoverable
> exception:
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****  (1213,
> 'Deadlock found when trying to get lock; try restarting transaction')
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****  Traceback
> (most recent call last):
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 214, in run
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> self.dispatchEvent(weewx.Event(weewx.CHECK_LOOP, packet=packet))
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 245, in dispatchEvent
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> callback(event)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 617, in check_loop
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****      raise
> BreakLoop
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> weewx.engine.BreakLoop
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****  During
> handling of the above exception, another exception occurred:
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****  Traceback
> (most recent call last):
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weedb/mysql.py", line 52, in guarded_fn
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****      return
> fn(*args, **kwargs)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weedb/mysql.py", line 262, in execute
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> self.cursor.execute(mysql_string, tuple(sql_tuple))
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 250, in execute
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> self.errorhandler(self, exc, value)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 50, in
> defaulterrorhandler
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****      raise
> errorvalue
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 247, in execute
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****      res =
> self._query(query)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 411, in _query
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****      rowcount =
> self._do_query(q)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 374, in _do_query
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****      db.query(q)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 292, in query
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> _mysql.connection.query(self, query)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> _mysql_exceptions.OperationalError: (1213, 'Deadlock found when trying to
> get lock; try restarting transaction')
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****  During
> handling of the above exception, another exception occurred:
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****  Traceback
> (most recent call last):
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewxd", line 157, in main
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> engine.run()
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 221, in run
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> self.dispatchEvent(weewx.Event(weewx.POST_LOOP))
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 245, in dispatchEvent
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> callback(event)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 627, in post_loop
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> self._software_catchup()
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 697, in _software_catchup
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> origin='software'))
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 245, in dispatchEvent
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> callback(event)
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****    File
> "/home/weewx/bin/weewx/engine.py", line 658, in new_archive_record
> May  1 03:20:43 pi33 wbx1[495] CRITICAL __main__:     ****
> dbmanager.addRecord(event.record, accumulator=self.old_accumulator)
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/09845fe4-5e21-4bc4-a835-54392dbf9589n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/09845fe4-5e21-4bc4-a835-54392dbf9589n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEASxLw5Ty0gTwLQjKSoNk4u0QqrocV8Bvc51ppgc%2Bwgcg%40mail.gmail.com.

Reply via email to