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

Attempt to avoid seemingly needless process wake-ups after TLS send #89

Open
m-ronnblom opened this issue Dec 13, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@m-ronnblom
Copy link
Collaborator

m-ronnblom commented Dec 13, 2023

In case an application successfully issues xcm_send() on a TLS/BTLS connection, and continues to go into select(), depending on what condition is set (with xcm_await()), the application may go directly out of select()/epoll_wait()/poll(), since XCM has put an always-active fd in the socket's epoll instance.

The reason for this BTLS transport behavior is indeed to force a wake-up, and to have the application issue whatever operation it desires (i.e., whatever the condition reflects). In the above-mentioned scenario, the app would call xcm_receive() and likely get a -1 back with errno set to EAGAIN. The reason XCM trigger this behavior is to get OpenSSL to answer the question "what should one wait for on the fd, in order to perform a SSL_write() or SSL_read a particular SSL object". There is no other way in OpenSSL to retrieve the condition to wait for to do an SSL_read() than to call SSL_read() and observe the result.

This is less than ideal from a performance perspective. The "wake-up" is likely not putting the thread to sleep, but a long series of syscalls are needed.

Investigate if this behavior can be improved and "bouncing" to select()/epoll_wait()/poll() can be avoided.

@m-ronnblom m-ronnblom changed the title Avoid seemingly needless epoll_wait()/select( Attempt to avoid seemingly needless process wake-ups after TLS send Dec 13, 2023
@m-ronnblom m-ronnblom added the enhancement New feature or request label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant