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

secure socket receiveTimeout throwing after configured timeout * 2 #3725

Closed
SpitchAG opened this issue Aug 1, 2022 · 4 comments · Fixed by #4510
Closed

secure socket receiveTimeout throwing after configured timeout * 2 #3725

SpitchAG opened this issue Aug 1, 2022 · 4 comments · Fixed by #4510
Assignees

Comments

@SpitchAG
Copy link

SpitchAG commented Aug 1, 2022

when creating a secure http server, default receiveTimeout for incoming socket is set to 60s. But the timeout is detected after 60*2s.

To reproduce just create a server secure socket, set the timeout to X seconds, call receiveBytes() and observe that the timeout exception is received after X*2s.

Timeout exception shall be received after Xs.

Please add relevant environment information:
ubuntu20
poco-1.11.1-release

Additional context
looking at code you see that SSL_read blocks during Xs, then there is a mustRetry calls that call socket->poll(Xs, READ) which will aslo block Xs, then exc is thrown

@SpitchAG SpitchAG added the bug label Aug 1, 2022
@aleks-f aleks-f added this to the Release 1.13.0 milestone Aug 1, 2022
@jngrb
Copy link

jngrb commented Sep 20, 2022

I know that this issue was observed on Ubuntu 2020, but I would like to note that I've also seen a timeout problem with SSL connections on Windows, see #3806

@github-actions
Copy link

This issue is stale because it has been open for 365 days with no activity.

@github-actions github-actions bot added the stale label Sep 21, 2023
Copy link

This issue was closed because it has been inactive for 60 days since being marked as stale.

@matejk
Copy link
Contributor

matejk commented Mar 25, 2024

@aleks-f , as far as I can see from the code, the timeout is used in receiveBytes/sendBytes and then again on failure in mustRetry as an argument to poll.

One of the naïve possibilities to resolve this is to set the timeout internally to half of the requested value in connect. Would that be sufficient?

@matejk matejk moved this to In Progress in 1.13 Mar 26, 2024
matejk added a commit that referenced this issue Mar 26, 2024
matejk added a commit that referenced this issue Mar 26, 2024
…g and handshaking (#4510)

* fix(SecureSocket): Refactor detection of timeout when reading, writing or handshaking. (#3725)

* enh(SecureSocket): some trivial C++17 modernisation changes.

* chore: indentation and compiler warning

---------

Co-authored-by: Alex Fabijanic <alex@pocoproject.org>
@github-project-automation github-project-automation bot moved this from In Progress to Done in 1.13 Mar 26, 2024
matejk added a commit that referenced this issue Mar 26, 2024
…g and handshaking (#4510)

* fix(SecureSocket): Refactor detection of timeout when reading, writing or handshaking. (#3725)

* enh(SecureSocket): some trivial C++17 modernisation changes.

* chore: indentation and compiler warning

---------

Co-authored-by: Alex Fabijanic <alex@pocoproject.org>
@matejk matejk added the fixed label Mar 27, 2024
aleks-f added a commit that referenced this issue Apr 2, 2024
* fix(SecureSocket): Refactor detection of timeout when reading, writing or handshaking. (#3725)

* enh(SecureSocket): some trivial C++17 modernisation changes.

* chore: indentation and compiler warning

* fix(SecureSocketImpl): not thread-safe (1st attempt) #4435

* fix(SecureSocketImpl): silence CodeQL cpp/certificate-not-checked

---------

Co-authored-by: Matej Kenda <matejken@gmail.com>
aleks-f added a commit that referenced this issue Apr 2, 2024
* fix(SecureSocket): Refactor detection of timeout when reading, writing or handshaking. (#3725)

* enh(SecureSocket): some trivial C++17 modernisation changes.

* chore: indentation and compiler warning

* fix(SecureSocketImpl): not thread-safe (1st attempt) #4435

* fix(SecureSocketImpl): silence CodeQL cpp/certificate-not-checked

---------

Co-authored-by: Matej Kenda <matejken@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
4 participants