tobiasschuerg / InfluxDB-Client-for-Arduino

Simple library for sending measurements to an InfluxDB with a single network request. Supports ESP8266 and ESP32.
MIT License
382 stars 95 forks source link

http status code 499 #219

Closed gasagna closed 1 year ago

gasagna commented 1 year ago

Steps to reproduce: Hi,

I have a problem with an esp32 board that sends sensor data to a private InfluxDB instance. The problem occurs quite rarely, which is annoying, and is quite difficult to reproduce.

I am also several thousand kilometers away from the board at the moment and can't debug the problem on the board, but I can read the influxdb logs on my private web server. Occasionally, I get this log message

May 29 12:36:51 antares influxd-systemd-start.sh[735]: ts=2023-05-29T12:36:51.282456Z lvl=debug msg=Request log_id=0i2XoCbG000 service=http method=POST host=www.ilmeteotraiduemondi.com:8086 path=/api/v2/write query="bucket=introd&org=EsperimentiDavide&precision=s" proto=HTTP/1.1 status_code=499 response_size=73 content_length=21538 referrer= remote=49.236.7.3:22980 user_agent=influxdb-client-arduino took=243.074ms error="internal error" error_code="internal error"

i.e. I get a status code 499. Reading around suggests that 499 occurs when a client terminates the connection before the server is able to respond.

I do not know if this info is sufficient, but any help or advise would be appreciated. I will try to obtain more info when I get access to the device. Maybe you have seen something similar before.

Feel free to close the issue if you feel this is not strong enough to be a proper issue.

Specifications:

vlastahajek commented 1 year ago

@gasagna, there can be many reasons for this. 1) A network connection is the least reliable part of the client <-> server communication channel. This is why this library has a feature for retrying failed writes. If you didn't turn it off, it is on by default. You can see errors, but do you miss data?

2) I would also recommend upgrading InfluxDB, version 2.6 had several weird issues.

3) Device issues can happen. If there is an issue in the app, the device can restart during WiFi communication and cause this behavior. It is reasonable to log (report) some device status along with restart info (reason).

gasagna commented 1 year ago

Thanks! It seems that part of the issues may also come from bugs in the arduino-esp32 core. I can close the issue for now, thanks for the help.