-
Notifications
You must be signed in to change notification settings - Fork 524
Using client behind AWS NAT #860
Comments
Any update on this? |
@rhajek is this issue on the radar? |
@dgnorton I will look on this. Keep alive tcp settings can be different on various platforms (ex. socket.TCP_KEEPIDLE is undefined on macOS), this is probably why urllib3 and requests libs do not set it by default and let operating system dafaults. The same issue we also have in the new client lib influxdb-client-python where we use the same urllib3/requests libs. Will help you if we make constructor of InfluxDBClient to support custom
I'am not sure what tcp socket settings should be hardcoded in client by default, 15x probe every 60s means that connection can be held for 15min. This may be dangerous to enable for all people as a default. |
Adding a |
@rhajek Could we please get an update on this? I see there is an open PR that is currently failing checks. |
Using the Python InfluxDB client behind an AWS NAT gateway
The AWS NAT gateway will time out an idle connection after 350 seconds. The InfluxDB Python library uses the Python requests module under the hood to create a session and make all of the InfluxDB API calls using that session. While requests supports keep-alive (https://requests.readthedocs.io/en/latest/user/advanced/#keep-alive) it does not set the TCP socket to use keep alive and send ping probes to keep the connection from appearing to be idle. To work around this issue, the following code enables TCP keep-alives, which starts sending keep-alive probes after the connection has been idle for 60 seconds, sends a probe every 60 seconds and sends a maximum of 15 keep alive probes.
Can this keep alive functionality be added to the InfluxDB Python client library so it doesn't have to be done by users of the library?
The text was updated successfully, but these errors were encountered: