Look in weewxd.py, not engine.py.

The function run() in engine.py is not involved in error recovery. Instead,
any uncaught exceptions filter up into main(), where there is a big
try/except block with different strategies for different exceptions. If all
else fails the exception is logged and the program exits (line 199 of
weewxd.py).

On Sun, Aug 2, 2026 at 6:20 PM Vince Skahan <[email protected]> wrote:

> I'm looking at the run( ) routine but not seeing except Exception, and
> don't understand what BreakLoop nor the commentary there means.
>
> In this case it's a docker container with a bunch of services configured
> and running weewx 5.4.0 in a venv using python 3.14.6 according to the
> debug=1 logs.
>
> vt-1  | 2026-08-01 08:35:18,219 weewxd[10] INFO weewx.manager: Added
> record 2026-08-01 08:35:00 EDT (1785587700) to database 'weewx.sdb'
> vt-1  | 2026-08-01 08:35:18,267 weewxd[10] INFO weewx.manager: Added
> record 2026-08-01 08:35:00 EDT (1785587700) to daily summary in 'weewx.sdb'
> vt-1  | 2026-08-01 08:35:19,204 weewxd[10] INFO weewx.restx: Windy:
> Published record 2026-08-01 08:35:00 EDT (1785587700)
> vt-1  | 2026-08-01 08:35:20,694 weewxd[10] INFO user.new_belchertown:
> version 2.1beta2
> vt-1  | 2026-08-01 08:35:54,730 weewxd[10] ERROR weewx.restx:
> StationRegistry: Failed to publish record 2026-08-01 08:35:00 EDT
> (1785587700): HTTP Error 429: TOO MANY REQUESTS
> vt-1  | 2026-08-01 08:40:17,595 weewxd[10] INFO weewx.manager: Added
> record 2026-08-01 08:40:00 EDT (1785588000) to database 'weewx.sdb'
> vt-1  | 2026-08-01 08:40:17,616 weewxd[10] INFO weewx.manager: Added
> record 2026-08-01 08:40:00 EDT (1785588000) to daily summary in 'weewx.sdb'
> vt-1  | 2026-08-01 08:40:22,644 weewxd[10] INFO weewx.engine: Main loop
> exiting. Shutting engine down.
> vt-1  | 2026-08-01 08:40:22,644 weewxd[10] INFO weewx.engine: Shutting
> down StdReport thread
> vt-1  | 2026-08-01 08:40:42,644 weewxd[10] ERROR weewx.engine: Unable to
> shut down StdReport thread
> vt-1  | 2026-08-01 08:40:43,174 weewxd[10] CRITICAL weewxd: Database
> OperationalError exception: database is locked
> vt-1  | 2026-08-01 08:40:43,175 weewxd[10] CRITICAL weewxd:     ****
>  Waiting 2 minutes then retrying...
> Gracefully Stopping... press Ctrl+C again to force
> Container docker-vt-1 Stopping
> Container docker-vt-1 Stopped
>
> The database locked line also got our attention since no StdReport skin
> actually seemed to have run to completion. My initial thought is that the
> beta forked belchertown's service code has issues (or the container is
> missing something it expects) or even that it might be the python gc thing
> John Kline did the deepdive on recently, but I can't see any logging
> instrumentation in the engine to figure out what is causing the main loop
> to exit.
>
> (I did ask the user (TomM) to rebuild his docker image with --no-cache and
> use python 3.11 or 3.12 to get a clean rebuild with the python version
> removed as a possibility, as well as to consider the usual slow walk before
> you run debugging steps ala  'disable every skin and extension, enable only
> Seasons, verify the core is stable, then turn things one one-by-one nice
> and slowly')
>
> My guess is it's a bug in the beta belchertown service code that comes
> with the skin, but some logs when the engine punts would help.
>
> Regardless, looking at engine.py I'm not seeing where it would log
> anything in shutdown( ) or  run( ) finally: or even any try/except logging
> around the gc collection if it fails, which is why I asked about if we
> could log something helpful when the engine punts.  Looks like a lot of
> places where it just can exit silently unless I'm misreading there.
>
> Not a world-ending thing in this case but it would be helpful to try to
> figure out why the engine is shutting down.  We do see a few of these
> 'weewx exited no idea why it did so' reports occasionally...
>
> On Sunday, August 2, 2026 at 5:35:26 PM UTC-7 Tom Keffer wrote:
>
>> Unless I'm misunderstanding you, that's basically what the "except
>> Exception" does at line 199 in weewxd.py.
>>
>> On Sun, Aug 2, 2026 at 4:24 PM Vince Skahan <[email protected]> wrote:
>>
>>> Is it possible to log 'why' weewx aborts via the finally: block in
>>> engine.py ?
>>>
>>> I'm trying to help somebody who is experiencing unusual aborts but
>>> figuring out why is pretty difficult if weewxd just stops for some reason
>>> (my guess is presumably a skin/extension blowing up).
>>>
>>> Can a python try/finally block log why it failed to the catchall
>>> finally: block ?   I'm looking specifically around line 219 in engine.py
>>>
>>>
>>> --
>>> 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 visit
>>> https://groups.google.com/d/msgid/weewx-user/a5a51863-37cf-42fd-89de-2bd57daba495n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/a5a51863-37cf-42fd-89de-2bd57daba495n%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 visit
> https://groups.google.com/d/msgid/weewx-user/601fbfee-f261-41cf-8997-0985112939ebn%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/601fbfee-f261-41cf-8997-0985112939ebn%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 visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zECNAKN_7RUfu4TLR%3D3yLGM%2B3PDCgV7SG9WJOdTxNdzdGw%40mail.gmail.com.

Reply via email to