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

Issue 6004 - idletimeout may be ignored #6005

Merged
merged 2 commits into from
Dec 11, 2023
Merged

Conversation

progier389
Copy link
Contributor

@progier389 progier389 commented Dec 6, 2023

Problem: idletimeout is still not handled when binding as non root (unless there are some activity
on another connection)
Fix:
Add a slapi_eq_repeat_rel handler that walks all active connection every seconds and check if the timeout is expired.
Note about CI test:
Notice that idletimeout is never enforced for connections bound as root (i.e cn=directory manager).

Issue #6004

Reviewed by: @droideck, @tbordaz (Thanks!)

@progier389 progier389 linked an issue Dec 6, 2023 that may be closed by this pull request
@progier389 progier389 self-assigned this Dec 6, 2023
Comment on lines +1163 to +1165
slapi_eq_repeat_rel(check_idletimeout, NULL,
slapi_current_rel_time_t(),
MILLISECONDS_PER_SECOND);
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it's not too often... (scanning all of the connections every second)

Probably, it makes sense to see that there is no performance drop in situations with many user connections.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I doubt we will notice anything:
During stress test the listener threads are walking all the active connections every tenth of ms (or even faster) to build and check the polling table so walking it every second should have an impact below 0.01%

Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

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

Patch looks good.
few comments

if (pthread_mutex_trylock(&(c->c_mutex)) == EBUSY) {
continue;
}
if (c->c_state != CONN_STATE_FREE && !c->c_gettingber &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is looking the opposite (!) of the test above (that skip this connection). It would be good to have a single macro/function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an inline function

/*
* slapi_eq_repeat_rel callback that checks that idletimeout has not expired.
*/
void
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this approach but I wonder why the previous approach is no longer working.
In slapd_deamon we are looping to call setup_pr_read_pds with a timeout (1s) on poll.
Is idletime not longer tested because this function is no longer used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

setup_pr_read_pds is still called (by ct_list_thread) at least every seconds but it does not test for idle timeout !
If you grep c_idletimeout in previous code, you see that the only place it is tested is in handle_pr_read_ready
and ct_list_thread does not call handle_pr_read_ready if the poll timed out

@progier389 progier389 merged commit 86b5969 into 389ds:main Dec 11, 2023
188 of 195 checks passed
@progier389 progier389 deleted the i6004 branch March 28, 2024 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

idletimeout may be ignored.
3 participants