Page 1 of 1

Problem (or not?)

Posted: Tue 24 Aug 2021 1:10 pm
by philpugh
I run my main CumulusMX station on a RPi 4 alongside my web server (NginX) and MariaDb.

Checking the logs on my server I notice that MySQL is racking up an error for each update to the Monthly table.

The error is
2021-08-24 13:55:01 2044 [Warning] Aborted connection 2044 to db: 'weather' user: '***********' host: 'localhost' (Got an error reading communication packets)
The relevant section of MXdiags log (with debug and data logging) is:
2021-08-24 13:54:45.622 ProcessData: Processing posted data
2021-08-24 13:54:45.622 ProcessData: Payload = PASSKEY=********************************&stationtype=GW1000A_V1.6.8&dateutc=2021-08-24+12:54:44&tempinf=68.7&humidityin=70&baromrelin=30.457&baromabsin=30.292&tempf=66.9&humidity=67&winddir=24&windspeedmph=3.58&windgustmph=5.82&maxdailygust=9.17&solarradiation=234.15&uv=2&rainratein=0.000&eventrainin=0.000&hourlyrainin=0.000&dailyrainin=0.000&weeklyrainin=0.118&monthlyrainin=3.598&yearlyrainin=30.079&totalrainin=30.079&temp1f=74.30&humidity1=60&temp2f=68.54&lightning_time=1629774669&lightning_num=1&lightning=37&wh65batt=0&batt1=0&batt2=0&wh57batt=4&freq=868M&model=GW1000_Pro
2021-08-24 13:54:45.624 ProcessData: StationType = GW1000A_V1.6.8, Model = GW1000_Pro, Frequency = 868MHz
2021-08-24 13:54:45.629 ProcessData: Complete
2021-08-24 13:54:46.634 Realtime[138]: Start cycle
2021-08-24 13:54:46.634 Realtime[138]: Creating realtime.txt
2021-08-24 13:54:46.635 Realtime[138]: Processing realtime file - realtimegauges.txt
2021-08-24 13:54:46.641 Realtime[138]: Processing extra file[1] - web/realtimegaugesT.txt
2021-08-24 13:54:46.647 Realtime[138]: Processing extra file[2] - web/realtimeclockT.txt
2021-08-24 13:54:46.650 Realtime[138]: Uploading - realtime.txt
2021-08-24 13:54:46.659 Realtime[138]: Uploading - realtimegauges.txt
2021-08-24 13:54:46.670 Realtime[138]: Uploading extra web file[1] web/realtimegaugesT.txttmp to /var/www/html/ecowitt/realtimegauges.txt
2021-08-24 13:54:46.680 Realtime[138]: Uploading extra web file[2] web/realtimeclockT.txttmp to /var/www/html/ecowitt/realtimeclock.txt
2021-08-24 13:54:46.689 Realtime[138]: End cycle
2021-08-24 13:55:00.157 DoLogFile: Writing log entry for 24/08/2021 13:55:00
2021-08-24 13:55:00.157 DoLogFile: max gust: 9
2021-08-24 13:55:00.157 DoLogFile: log entry for 24/08/2021 13:55:00 written
2021-08-24 13:55:00.159 Writing today.ini, LastUpdateTime = 24/08/2021 13:55:00 raindaystart = 764.0066 rain counter = 764.0066
2021-08-24 13:55:00.160 DoExtraLogFile: Writing log entry for 24/08/2021 13:55:00
2021-08-24 13:55:00.161 DoExtraLogFile: Log entry for 24/08/2021 13:55:00 written
2021-08-24 13:55:00.161 Creating standard web files
2021-08-24 13:55:00.162 Windy: URL = https://stations.windy.com/pws/update/< ... =67&uv=2.0
2021-08-24 13:55:00.163 http://www.pwsweather.com/pwsupdate/pws ... =updateraw
2021-08-24 13:55:00.164 DoLogFile: MySQL executing - INSERT IGNORE INTO Monthly (LogDateTime,Temp,Humidity,Dewpoint,Windspeed,Windgust,Windbearing,RainRate,TodayRainSoFar,Pressure,Raincounter,InsideTemp,InsideHumidity,LatestWindGust,WindChill,HeatIndex,UVindex,SolarRad,Evapotrans,AnnualEvapTran,ApparentTemp,MaxSolarRad,HrsSunShine,CurrWindBearing,RG11rain,RainSinceMidnight,WindbearingSym,CurrWindBearingSym,FeelsLike,Humidex) Values('21-08-24 13:55',19.4,67,13.1,6,9,56,0.0,0.0,1031.4,764.0,20.4,70,6,19.4,19.4,2.0,234,0.00,0.00,18.4,704,0.0,24,0.0,0.0,'NE','NNE',18.7,22.2)
2021-08-24 13:55:00.166 Current CPU temp = 56.5°C
2021-08-24 13:55:00.170 DoLogFile: MySQL 1 rows were affected.
2021-08-24 13:55:00.206 Done creating standard Data file
2021-08-24 13:55:00.207 Creating graph data files
2021-08-24 13:55:00.239 Windy: Response = OK: SUCCESS (valid measurements count: 9, valid station info count: 0)
2021-08-24 13:55:00.557 PWS Response: OK: <html lang="en">
Now it seems to have started around the time I updated to b3143 but I can't be absolutely sure. I don't recall ever seeing this error before.

Now I'm not saying it is due to CumulusMX but other operations on other databases don't seem to be causing the same problem.

Any MySQL 'experts' care to comment please?

Re: Problem (or not?)

Posted: Tue 24 Aug 2021 2:03 pm
by philpugh
A thought.

Googling the error gives a myriad of possible causes but I have tried the simpler ones without any affect.

One I can't try is to ensure that the connection is closed correctly after each operation - I'm sure that this is happening?

Re: Problem (or not?)

Posted: Tue 24 Aug 2021 3:13 pm
by mcrossley
Hi Phil, yes the connection is closed after each insert (or commit if more than record is being added). The SQL connection is also opened in a using block, so should be closed and disposed automatically as the function exits even if the explicit close was not run.

Re: Problem (or not?)

Posted: Tue 24 Aug 2021 3:16 pm
by mcrossley
Also, I'm running a pretty identical setup to you - rPi4, MariaDB, Nginx - and not seeing any issues.

Re: Problem (or not?)

Posted: Tue 24 Aug 2021 3:51 pm
by philpugh
Thanks Mark. I never doubted it!

I'll keep on digging.

Re: Problem (or not?)

Posted: Tue 24 Aug 2021 3:54 pm
by Mapantz
I wonder if it's anything to do with a setting in you .cnf file?

https://dba.stackexchange.com/questions ... on-packets

Re: Problem (or not?)

Posted: Tue 24 Aug 2021 7:13 pm
by philpugh
Thanks - I had seen that and tried solutions - but none worked.

BUT.. Then i remembered I had rebooted the server and an old bit of python code I had been messing around with earlier this month got re-started and it wasn't closing the database correctly (don't know if there is an EMOJI for extremely embarrassed !) :bash:

Getting older is a wonderful thing but I must remember to tidy up rogue code!