Skip to content
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

fixed callback for CURLMOPT_TIMERFUNCTION not being called again when… #15627

Closed
wants to merge 3 commits into from

Conversation

sokurenko
Copy link
Contributor

@sokurenko sokurenko commented Nov 22, 2024

Issue is reproducible for me if I have made request with multi handle, then I make request that will take very long and then I make request that should be fast again, however what happens it is that it seems to think that timeout was not changed and it makes it not call initial CURLMOPT_TIMERFUNCTION

Log:
508228:20241122:172515.743 In zbx_http_request_prepare() request method 'GET' URL 'localhost:8080/hello' headers ''
508228:20241122:172515.761 End of zbx_http_request_prepare():SUCCEED
expire timestamps:0.0 -> 20372.68080 now:20372.71430 timeout_ms:0
Curl_update_timer(), had no timeout, set now
Curl_update_timer(), set timeout 0ms
508228:20241122:172515.771 start_timeout() timeout:0
508228:20241122:172515.773 In zbx_http_request_prepare() request method 'GET' URL 'localhost:8080/timeout' headers ''
508228:20241122:172515.774 End of zbx_http_request_prepare():SUCCEED
expire timestamps:20372.68080 -> 20372.68080 now:20372.80296 timeout_ms:0
Curl_update_timer(), same expire timestamp, no change
508228:20241122:172515.781 End of async_initiate_queued_checks(): num:2
508228:20241122:172515.782 In on_timeout()
508228:20241122:172515.880 In handle_socket() action:2
508228:20241122:172515.882 End of handle_socket()
508228:20241122:172515.889 In handle_socket() action:2
508228:20241122:172515.889 End of handle_socket()
expire timestamps:20372.68080 -> 20372.347305 now:20372.195431 timeout_ms:153
Curl_update_timer(), expire timestamp changed
Curl_update_timer(), set timeout 153ms
508228:20241122:172515.891 start_timeout() timeout:153
508228:20241122:172515.892 End of on_timeout()
508228:20241122:172515.893 In curl_perform()
508228:20241122:172515.959 In handle_socket() action:4
508228:20241122:172515.960 End of handle_socket()
expire timestamps:20372.347305 -> 20372.390129 now:20372.266304 timeout_ms:124
Curl_update_timer(), expire timestamp changed
Curl_update_timer(), set timeout 124ms
508228:20241122:172515.962 start_timeout() timeout:124
508228:20241122:172515.962 running_handles:1
508228:20241122:172515.963 pending cURL messages:0
508228:20241122:172515.964 In process_httpagent_result()
508228:20241122:172515.972 name 'Content-Type' value 'text/plain; charset=utf-8' amount:1 index:0 origin:134217729
508228:20241122:172515.985 finished processing itemid:48298
508228:20241122:172515.995 End of process_httpagent_result()
508228:20241122:172515.995 End of curl_perform()
508228:20241122:172515.995 In curl_perform()
508228:20241122:172515.999 In handle_socket() action:1
508228:20241122:172515.999 End of handle_socket()
expire timestamps:20372.390129 -> 20372.390129 now:20372.304592 timeout_ms:86
Curl_update_timer(), same expire timestamp, no change
508228:20241122:172516.000 running_handles:1
508228:20241122:172516.000 End of curl_perform()
508228:20241122:172516.001 In zbx_ipc_socket_open()
508228:20241122:172516.001 End of zbx_ipc_socket_open():SUCCEED
508228:20241122:172516.002 In zbx_ipc_socket_write()
508228:20241122:172516.003 End of zbx_ipc_socket_write():SUCCEED
508228:20241122:172516.004 requeue num:1
508228:20241122:172516.016 requeue items nextcheck:1732289158
508228:20241122:172516.019 In on_timeout()
expire timestamps:20372.390129 -> 20372.390129 now:20372.324148 timeout_ms:66
Curl_update_timer(), same expire timestamp, no change
508228:20241122:172516.020 End of on_timeout()
508228:20241122:172516.679 In zbx_dc_config_get_poller_items() poller_type:7
508228:20241122:172535.692 End of zbx_prepare_items()
508228:20241122:172535.692 queue processing_num:1 pending:0
508228:20241122:172535.693 In async_initiate_queued_checks()
508228:20241122:172535.693 In zbx_http_request_prepare() request method 'GET' URL 'localhost:8080/hello' headers ''
508228:20241122:172535.693 End of zbx_http_request_prepare():SUCCEED
expire timestamps:20372.390129 -> 20372.390129 now:20391.998933 timeout_ms:0
Curl_update_timer(), same expire timestamp, no change

@icing icing self-requested a review November 22, 2024 15:19
Copy link
Contributor

@icing icing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

@MarcelRaad
Copy link
Member

I was just debugging a hang when using an invalid URL with the multi_socket API after a58b50f and I can confirm that this fixes it! Thanks!

@vszakats vszakats closed this in 4cded6d Nov 25, 2024
@vszakats
Copy link
Member

Thank you! This is merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants