Any number of errors will cause WeeWX to "start from the top," that is, essentially, reboot the internal engine. One such error is a database error. Part of the rebooting process is to kill the reporting thread.
So, my guess is that your MySQL database went offline for some reason. This caused the internal engine to kill the reporting thread, then do a restart. I don't know why your MySQL database went offline --- you'll have to search for clues elsewhere. Try its error log (found in /var/log/mysql for Debian systems). For systemd versions you can try "journalctl -u mysql" for clues. -tk On Thu, Oct 5, 2017 at 11:13 AM, fpb <[email protected]> wrote: > Hi All. > > I am sorry for this question, but I am stuck in solving this problem. > > I had been written driver for my IP and XML based PWS. Due to some > troubles in my network I am loosing connection to PWS. > > I tried to manage this situation with goal "When PWS is back online all > data will be stored to WEEWX without user action." > Driver using GenArchiveRecords since from first version witht correct > management of missing data (TS_SINCE), but there was not done any better > exception handling. I have been tried add exception handling described in > docs and examples, but I am stuck in this situation, that "engine: Shutting > down StdReport thread" comming and I do not have any real idea why. My > guess is because of MySQL DB has closed session and can not be reconnected. > > Can give me somebody some hints, how to handle exceptions for lost > connections to PWS, that it will continue grab data from PWS when it come > back online (grabing from first missing data works correctly)? > > Thank you anybody who can help me to understand and tips how to handle it. > > > > Below is last part of log. First part is my driver handling of lost > connection, then after more then 2 days engine come with StdReport + MySQL > exception. Behavior is that some times fails in 1 day somtimes in 2 or 3 > days. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *LOG:Oct 3 7:06:15 ferda weewx[7865]: wanet3: from > http://me13.lbn.cz/xml.xml <http://me13.lbn.cz/xml.xml> download failed > attempt 1: 5 <urlopen error timed out> . . . Oct 5 18:38:59 ferda > weewx[7865]: wanet3: from http://me13.lbn.cz/xml.xml > <http://me13.lbn.cz/xml.xml> download failed attempt 1: 5 <urlopen error > timed out>Oct 5 18:39:39 ferda weewx[7865]: wanet3: from > http://me13.lbn.cz/xml.xml <http://me13.lbn.cz/xml.xml> download failed > attempt 2: 5 <urlopen error timed out>Oct 5 18:40:19 ferda weewx[7865]: > wanet3: from http://me13.lbn.cz/xml.xml <http://me13.lbn.cz/xml.xml> > download failed attempt 3: 5 <urlopen error timed out>Oct 5 18:40:59 ferda > weewx[7865]: wanet3: from http://me13.lbn.cz/xml.xml > <http://me13.lbn.cz/xml.xml> download failed attempt 4: 5 <urlopen error > timed out>Oct 5 18:41:40 ferda weewx[7865]: wanet3: from > http://me13.lbn.cz/xml.xml <http://me13.lbn.cz/xml.xml> download failed > attempt 5: 5 <urlopen error timed out>Oct 5 18:42:10 ferda weewx[7865]: > wanet3: download failed after 5 triesOct 5 18:43:20 ferda weewx[7865]: > wanet3: from http://me13.lbn.cz/xml.xml <http://me13.lbn.cz/xml.xml> > download failed attempt 1: 5 <urlopen error timed out>Oct 5 18:44:00 ferda > weewx[7865]: wanet3: from http://me13.lbn.cz/xml.xml > <http://me13.lbn.cz/xml.xml> download failed attempt 2: 5 <urlopen error > timed out>Oct 5 18:44:40 ferda weewx[7865]: wanet3: from > http://me13.lbn.cz/xml.xml <http://me13.lbn.cz/xml.xml> download failed > attempt 3: 5 <urlopen error timed out>Oct 5 18:45:20 ferda weewx[7865]: > wanet3: from http://me13.lbn.cz/xml.xml <http://me13.lbn.cz/xml.xml> > download failed attempt 4: 5 <urlopen error timed out>Oct 5 18:46:00 ferda > weewx[7865]: wanet3: from http://me13.lbn.cz/xml.xml > <http://me13.lbn.cz/xml.xml> download failed attempt 5: 5 <urlopen error > timed out>Oct 5 18:46:30 ferda weewx[7865]: wanet3: download failed after > 5 triesOct 5 18:47:30 ferda weewx[7865]: engine: Shutting down StdReport > threadOct 5 18:47:30 ferda weewx[7865]: engine: Caught unrecoverable > exception in engine:Oct 5 18:47:30 ferda weewx[7865]: **** (2006, > 'MySQL server has gone away')Oct 5 18:47:30 ferda weewx[7865]: **** > Traceback (most recent call last):Oct 5 18:47:30 ferda weewx[7865]: > **** File "/usr/share/weewx/weewx/engine.py", line 871, in mainOct 5 > 18:47:30 ferda weewx[7865]: **** engine.run()Oct 5 18:47:30 ferda > weewx[7865]: **** File "/usr/share/weewx/weewx/engine.py", line 190, > in runOct 5 18:47:30 ferda weewx[7865]: **** > self.dispatchEvent(weewx.Event(weewx.NEW_LOOP_PACKET, packet=packet))Oct 5 > 18:47:30 ferda weewx[7865]: **** File > "/usr/share/weewx/weewx/engine.py", line 223, in dispatchEventOct 5 > 18:47:30 ferda weewx[7865]: **** callback(event)Oct 5 18:47:30 > ferda weewx[7865]: **** File "/usr/share/weewx/weewx/wxservices.py", > line 45, in new_loop_packetOct 5 18:47:30 ferda weewx[7865]: **** > self.calc.do_calculations(event.packet, 'loop')Oct 5 18:47:30 ferda > weewx[7865]: **** File "/usr/share/weewx/weewx/wxservices.py", line > 189, in do_calculationsOct 5 18:47:30 ferda weewx[7865]: **** > getattr(self, 'calc_' + obs)(data_us, data_type)Oct 5 18:47:30 ferda > weewx[7865]: **** File "/usr/share/weewx/weewx/wxservices.py", line > 232, in calc_pressureOct 5 18:47:30 ferda weewx[7865]: **** > data['dateTime'], interval)Oct 5 18:47:30 ferda weewx[7865]: **** > File "/usr/share/weewx/weewx/wxservices.py", line 434, in > _get_temperature_12hOct 5 18:47:30 ferda weewx[7865]: **** record > = dbmanager.getRecord(ts12, max_delta=self.max_delta_12h)Oct 5 18:47:30 > ferda weewx[7865]: **** File "/usr/share/weewx/weewx/manager.py", > line 369, in getRecordOct 5 18:47:30 ferda weewx[7865]: **** > (time_start_ts, time_stop_ts, timestamp))Oct 5 18:47:30 ferda > weewx[7865]: **** File "/usr/share/weewx/weedb/mysql.py", line 47, > in guarded_fnOct 5 18:47:30 ferda weewx[7865]: **** raise > klass(e)Oct 5 18:47:30 ferda weewx[7865]: **** DatabaseError: (2006, > 'MySQL server has gone away')Oct 5 18:47:30 ferda weewx[7865]: **** > Exiting.* > >
