@Ryan_S, @borpin,
First, thanks to @borpin for the contribution top this issue. While it’s not quite resolved, the effort to secure shark logs has provided some key information. At the same time @Ryan_S has been posting to a similar thread in the IoTaWatt Forum https://community.iotawatt.com/t/not-posting-to-emoncms/1348
This morning I received a key piece of information that has, I think, brought this into better focus. The local timezone in the IoTaWatt appears to be set to UTC+5 hours while it should be UTC-5, and with DST the difference is -9 hours. That has no bearing on the IoTaWatt/Emoncms link as both are using UTC, but it does resolve discrepancies in the IoTaWatt log that are timestamped with the wrong local time.
So the background is that this user attempted an update to his local Emoncms sometime the morning of Oct 28. The exact time is uncertain by the details offered, in fact, this was not even mentioned in the original report but came out a day later. In hindsight, I believe the problem originates there.
The IoTaWatt log covering that period:
Note that while the log begins with UTC (z), the timestamps change to local time after the config is processed to declare local time +5. Those subsequent timestamps should be -9 hours.
So the system was restarted by the user at 11:12:53 EDT on Oct 28. It was running OK with Emoncms posting from just before the restart at 11:12:50. Then at 12:52:52 communication to Emoncms began to timeout (-11 is an IoTaWatt timeout indication). After 1.5 hours of normal operation, this problem begins spontaneously i.e. nothing remarkable being logged.
Subsequently, everytime the IoTaWatt is restarted, it successfully obtains a list of inputs from Emoncms. That list contains the last post time for each of the inputs, and IoTaWatt assumes those inputs were processed to feeds. So it begins uploading with the next frame. But that subsequent upload times out, and as the IoTaWatt continues to retry, the retries also time-out. IoTaWatt times out after two seconds without a response.
To reinforce this scenario, the /input/bulk transaction contains 15 frames at 5 second intervals covering 75 seconds. Each time the IoTaWatt restarts, the last input timestamp advances by 75 seconds, indicating that the input was updated with the new data.
Now the shark tank from the tshark log above:
Here we see an /input/bulk from IoTaWatt. The first is the connection followed by the payload. I’m not familiar with the format, but I’m taking a leap here to guess that the second column is the time in seconds. So after the ACK to the connection the payload followed within 23ms. The subsequent payload transfer seems to have taken longer at about 2717ms. Emoncms responds OK after about 4 seconds from the initial connect. That’s too long. IoTaWatt has already timed out.
Now the question is “What’s the holdup?”
- It could be the router as Brian’s last post suggests, but I doubt it.
- It could be the server that Emoncms is running on, more likely.
- It could be Emoncms is having database trouble (Im getting out of my comfort zone here) and it takes a long time to post the inputs.
Another piece of the puzzle seems to be evident in the sample of Emoncms log that was posted:
2019-10-29 20:50:02.004|INFO|feed_model.php|insert_data() feedid=23 updatetime=1572281845 feedtime=1572281845 value=19.28 arg=
2019-10-29 20:50:01.937|INFO|feed_model.php|insert_data() feedid=30 updatetime=1572281845 feedtime=1572281845 value=0.77 arg=
2019-10-29 20:50:01.966|INFO|feed_model.php|insert_data() feedid=31 updatetime=1572281845 feedtime=1572281845 value=5.62 arg=
2019-10-29 20:50:02.004|INFO|feed_model.php|insert_data() feedid=23 updatetime=1572281845 feedtime=1572281845 value=19.28 arg=
2019-10-29 20:50:01.966|INFO|feed_model.php|insert_data() feedid=31 updatetime=1572281845 feedtime=1572281845 value=5.62 arg=
2019-10-29 20:50:02.004|INFO|feed_model.php|insert_data() feedid=23 updatetime=1572281845 feedtime=1572281845 value=19.28 arg=
2019-10-29 20:50:01.966|INFO|feed_model.php|insert_data() feedid=31 updatetime=1572281845 feedtime=1572281845 value=5.62 arg=
2019-10-29 20:50:01.901|INFO|feed_model.php|insert_data() feedid=22 updatetime=1572281845
I don’t understand all of this, but my sense is that it’s a log of data being sent from the inputs to the feeds. This snapshot is taken the next day, yet the timestamps for the data are Oct 28, 12:57pm EDT, which is consistent with the advanced input time resulting from several 75 second restart advances.
So to sum up, it appears that something has happened to the Emoncms server that causes consistently delayed responses outside of the 2 minute time-out window. My sense is that it’s an installation/configuration issue rather than a bug in either software. The two second time-out has been in place for a long time, with both local and remote Emoncms systems experiencing an occasional timeout that is retried and recovered. That’s preferred to leaving an operation hanging with associated buffers for extended periods because it consumes limited resources in IoTaWatt that may be needed to post to other servers or do internal housekeeping.
I would look at performing a clean install of Emoncms.