-
Notifications
You must be signed in to change notification settings - Fork 973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client connection becomes stale after long periods of time. #225
Comments
Hmm, interesting. If the socket doesn't drop cleanly (e.g. half-open socket), it's possible the curl handles will just hang...although they should timeout eventually. I'm surprised you don't see a timeout at all. I'll try to setup some tests to see why this is the case. As mentioned in #226, you can tell curl to explicitly close connections after each use by using |
I attempted to set the the following options but it did not timeout. I ended up having my code create a new instance of the Client for every connection( I am not making that many requests so it is not a big deal, only about 10 requests over a 20 minute period). I just added the CURLOPT_FORBID_REUSE, and now the connections will close immediately which is a big help. I would still be interested int he results form your tests though.
|
Agreed, it's quite odd. I wonder if it is a limitation of libcurl perhaps? Not sure, will need to dig into it next week with proper testing. I'll update this thread when I have more news :) |
Closing, this is likely no longer relevant since we're not on that version of guzzle anymore :) |
How i can tell curl use |
Arbitrary curl options go inside $params = [
'index' => 'posts',
'type' => 'tags',
'id' => 24,
'client' => [
'curl' => [
CURLOPT_FORBID_REUSE => true // <-- here
]
]
]; |
I have a long running background job and I am making calls to ES at different points throughout the job to update fields in ES. After not calling ES for about 8 minutes and trying to make a call though the client again it will just hang. I do not receive any exceptions or timeout. it just hangs. is there a reason this could be happening? Does the client connection persist the whole time my job is running from the initial instantiation? is there a way to reconnect?
UPDATE:
I have found this to be a problem with my load balancer that ES is behind, it kills tcp connections after 5 minutes. the problem is that my persistent connection does not register the connection being closed so it just hangs. Is there a way to reset the connection? or have the client ping every 60 seconds?
The text was updated successfully, but these errors were encountered: