[ https://issues.apache.org/jira/browse/TINKERPOP-2807?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephen Mallette closed TINKERPOP-2807. --------------------------------------- Resolution: Cannot Reproduce More recent testing is not demonstrating the same thing that I was seeing before for some reason. For future reference it's worth pointing to the code in aiohttp I was looking at which gave me some pause earlier (noting the comment there especially about the approach to heartbeat being "not perfect"): https://github.com/aio-libs/aiohttp/blob/v3.8.1/aiohttp/client_ws.py#L89-L100 I feel a bit perplexed at not being able to reproduce that situation anymore, but it also makes me feel a bit better knowing that the heartbeat does seem to work properly. I can see the ping being sent now and the server responding accordingly with a pong. That said, two things were learned. First, heartbeat is not enabled by default. There was some thinking that it was defaulted to five seconds. I don't see that. Second, I do think that one of the problems that folks might be having with this functionality comes from our documentation. In the documentation we configure the heartbeat for one second, with the thinking being that a ping would be sent every second to keep the connection alive. If you copy/pasted that exact configuration to use it will create a problem. One second is simply too short a time period for the heartbeat based on how aiohttp uses that number. aiohttp uses 1 second as interval for sending a ping but then uses half that number to determine the response time for the pong, which in that case would be half a second. I imagine there are scenarios where a half second might not be enough time and would and if that response time is exceeded the connection is closed and any pending requests will fail with the connection closed. I've updated the documentation a bit to try to explain this feature a bit better: https://github.com/apache/tinkerpop/commit/e403ad40d97ce57236022f404e53f3f16bd82a01 I would have liked to have written a test for this, but until we have the revisions to the {{SimpleSocketServer}} in play I don't think that's possible. Since this feature appears to be working and now that there is a better understanding for how it works I don't think there is much more to do here. > heartbeat setting to AiohttpTransport does not prevent the idle connections > from being closed > --------------------------------------------------------------------------------------------- > > Key: TINKERPOP-2807 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2807 > Project: TinkerPop > Issue Type: Bug > Components: driver > Affects Versions: 3.5.4 > Reporter: Stephen Mallette > Assignee: Stephen Mallette > Priority: Blocker > > Setting {{heartbeat}} like this: > {code} > Client('ws://localhost:45940/gremlin', 'g', > transport_factory=lambda: transport.AiohttpTransport(heartbeat=5.0)) > {code} > should send a ping message to the server to keep the connection alive but it > clearly does not. Manual testing shows Gremlin Server closing the connection > as idle despite this setting. > For more information on the setting see: > https://docs.aiohttp.org/en/stable/client_reference.html -- This message was sent by Atlassian Jira (v8.20.10#820010)