weewx keeps crashing

109 views
Skip to first unread message

Matt Frost

unread,
Oct 24, 2019, 7:48:13 PM10/24/19
to weewx-user
I upgraded to weewx 3.9.2 a few months back. Everything was fine for awhile but then several weeks ago weewx started crashing. Here is what I currently see:

pi@weather:~ $ sudo /etc/init.d/weewx status
● weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx)
   Active: active (exited) since Wed 2019-10-23 17:27:22 CDT; 24h ago
  Process: 425 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS)
Oct 24 09:05:15 weather weewx[758]: ****    File "/usr/share/weewx/weewx/manager.py", line 1216, in _addSingleRecord
Oct 24 09:05:15 weather weewx[758]: ****      _day_summary.addRecord(record, weight=_weight)
Oct 24 09:05:15 weather weewx[758]: ****    File "/usr/share/weewx/weewx/accum.py", line 260, in addRecord
Oct 24 09:05:15 weather weewx[758]: ****      func(self, record, obs_type, add_hilo, weight)
Oct 24 09:05:15 weather weewx[758]: ****    File "/usr/share/weewx/weewx/accum.py", line 318, in add_value
Oct 24 09:05:15 weather weewx[758]: ****      self[obs_type].addHiLo(val, record['dateTime'])
Oct 24 09:05:15 weather weewx[758]: ****    File "/usr/share/weewx/weewx/accum.py", line 78, in addHiLo
Oct 24 09:05:15 weather weewx[758]: ****      "got type '%s' ('%s')" % (type(val), val))
Oct 24 09:05:15 weather weewx[758]: ****  ValueError: accum: ScalarStats.addHiLo expected float or int, got type '<type 'long'>' ('3840714016')
Oct 24 09:05:15 weather weewx[758]: ****  Exiting.
pi@weather:~ $

I found a couple of posts online regarding an issue in cmon that sounded like the same issue I am seeing and applied these fixes:

    456                         if k in self.last_net[iface]:
    457                             x = int(values[i]) - self.last_net[iface][k]
    458                             if x < 0:
    459                                 maxcnt = 0x100000000 # 32-bit counter
    460                                 if x + maxcnt < 0:
    461                                     maxcnt = 0x10000000000000000 # 64-bit counter
    462                                 x += maxcnt
    463                                 if x > 2147483648:
    464                                     x = 2147483648
    465                             record['net_' + iface + '_' + k] = int(x)

Unfortunately I still have the same issue. weewx will run for a few hours and crash again. Restarting weewx does not work I have to reboot my pi to get weewx to start again and run for a few more hours.

Any help is appreciated.

Thomas Keffer

unread,
Oct 24, 2019, 8:17:18 PM10/24/19
to weewx-user
Hello,

My best guess is that somewhere among the myriad of things that cmon measures is something that is of type 'long', but it's hard to say with only a small snippet of the log.

Try running weewx directly from the command line, and watching the values go by. If something is of type long, it will be marked with an 'L'. E.g., 123456L.

-tk

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6fda9f5c-cf54-44e0-b5a3-547eede77d94%40googlegroups.com.

gjr80

unread,
Oct 25, 2019, 6:47:40 AM10/25/19
to weewx-user
Tom,

This is the second issue of this type I am aware of and whilst cmon was the source for both, on the basis of the OP it appears they are from different sources within cmon. As WeeWX can be fed with all manner of sources is it worth a try..except in the add_value() method to catch the ValueError and report the miscreant field?

Gary

On Friday, 25 October 2019 10:17:18 UTC+10, Thomas Keffer wrote:
Hello,

My best guess is that somewhere among the myriad of things that cmon measures is something that is of type 'long', but it's hard to say with only a small snippet of the log.

Try running weewx directly from the command line, and watching the values go by. If something is of type long, it will be marked with an 'L'. E.g., 123456L.

-tk

To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Thomas Keffer

unread,
Oct 25, 2019, 8:22:02 AM10/25/19
to weewx-user
That would be the next step: instrument accum.py to show what's tripping it up. 

Matt, have you been successful in finding the 'long' data?

-tk

To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6aa05b54-fc25-442f-a356-3f86cf8859e8%40googlegroups.com.

Thomas Keffer

unread,
Oct 25, 2019, 1:35:57 PM10/25/19
to weewx-user
Speaking of which, and I may regret saying this, but I don't see any reason why the filter on types acceptable to the accumulator can't be broadened to include 'long'. If you add a long to an int, you get a long, without a TypeError.

So, another alternative is to change the code from this:

if val is not None:
# Check for non-numbers and for NaN
if not isinstance(val, (float, int)) or val != val:
raise ValueError("accum: ScalarStats.addHiLo expected float or int, "
                         "got type '%s' ('%s')" % (type(val), val))

to this:

if val is not None:
# Check for non-numbers and for NaN
if not isinstance(val, (float, int, long)) or val != val:
raise ValueError("accum: ScalarStats.addHiLo expected float, int, or long; "
                         "got type '%s' ('%s')" % (type(val), val))

NB: This will all be changing in V4, which will definitely allow longs (as well as strings!).

-tk

Matt Frost

unread,
Oct 25, 2019, 7:10:19 PM10/25/19
to weewx-user
I have not had any luck finding the bad data. Unfortunately it takes several hours for it to crash when running normally. I left weewx running from command line since last evening but it is still running. I assumed it would terminate if it found a bad value again but maybe that was not a valid assumption.

Thomas Keffer

unread,
Oct 25, 2019, 7:13:07 PM10/25/19
to weewx-user
I can imagine you don't want to sit there staring at the command line looking for an 'L' for a few hours. :-)

Did you try the modification I outlined earlier? That should at least make it go away.

-tk



On Fri, Oct 25, 2019 at 4:10 PM Matt Frost <matt.e...@gmail.com> wrote:
I have not had any luck finding the bad data. Unfortunately it takes several hours for it to crash when running normally. I left weewx running from command line since last evening but it is still running. I assumed it would terminate if it found a bad value again but maybe that was not a valid assumption.

--
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 weewx-user+...@googlegroups.com.

Matt Frost

unread,
Oct 25, 2019, 7:30:28 PM10/25/19
to weewx-user
I have not but will try that next and let you know the results.

Matt Frost

unread,
Oct 25, 2019, 9:20:04 PM10/25/19
to weewx-user
OK I made that change. Now I'm getting this. This errors out much quicker than before.

Oct 25 20:15:15 weather weewx[783]: ****    File "/usr/share/weewx/weewx/manager.py", line 1216, in _addSingleRecord
Oct 25 20:15:15 weather weewx[783]: ****      _day_summary.addRecord(record, weight=_weight)
Oct 25 20:15:15 weather weewx[783]: ****    File "/usr/share/weewx/weewx/accum.py", line 260, in addRecord
Oct 25 20:15:15 weather weewx[783]: ****      func(self, record, obs_type, add_hilo, weight)
Oct 25 20:15:15 weather weewx[783]: ****    File "/usr/share/weewx/weewx/accum.py", line 319, in add_value
Oct 25 20:15:15 weather weewx[783]: ****      self[obs_type].addSum(val, weight=weight)
Oct 25 20:15:15 weather weewx[783]: ****    File "/usr/share/weewx/weewx/accum.py", line 95, in addSum
Oct 25 20:15:15 weather weewx[783]: ****      "got type '%s' ('%s')" % (type(val), val))
Oct 25 20:15:15 weather weewx[783]: ****  ValueError: accum: ScalarStats.addSum expected float or int, got type '<type 'long'>' ('3840714016')
Oct 25 20:15:15 weather weewx[783]: ****  Exiting.

Thomas Keffer

unread,
Oct 25, 2019, 9:31:19 PM10/25/19
to weewx-user
Sorry. There are actually 4 places in accum.py that have to be changed.

Use the attached copy of accum.py

-tk



--
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 weewx-user+...@googlegroups.com.
accum.py

Matt Frost

unread,
Oct 25, 2019, 9:52:40 PM10/25/19
to weewx-user
OK I'm back up and running. I'll update tomorrow if I see the initial problem again or not. Thanks.

Matt Frost

unread,
Oct 26, 2019, 12:19:36 PM10/26/19
to weewx-user
It's looking like the issue is resolved. Still no crash so far. Thanks again for the help.
Reply all
Reply to author
Forward
0 new messages