-
Notifications
You must be signed in to change notification settings - Fork 235
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
pid wrapping caused sss_cli_check_socket to close the file descriptor opened by the process #6592
Comments
The following code can reproduce the problem:
|
What SSSD version do you use and what is the OS? |
As a work around you can call any NSS function explicitly after |
we can not modify the application now, is it possible to modify sssd in the following way to reduce the risk of pid wrapping.
|
patch as follows:
|
In general, makes sense, imo. Patch would benefit from more telling variable names and also handling of Would you mind to open a PR? |
Yes,I tested it with the above test case and solved the problem of pid wrapping. |
We encountered a problem: the tcp socket of a database child process was replaced by a unix socket. After locating, it was found that the "sss_cli_check_socket" function closed the tcp socket opened by the process due to the wrapping of the pid.
The problem recurrence logic is as follows:
1) A unix socket connection to sssd_nss is established when process A calls getpwnam(), then process A exits after fork process B.
2) Process B closes all file descriptors, creates a tcp socket, and then fork process C. Process B will restart process C after process C exits abnormally.
3) Process C has restarted abnormally many times, resulting in the pid of process C being equal to that of process A. At this time, process C calls the getpwnam() function, causing the tcp socket to be replaced by a unix socket.
how to solve this problem?
The text was updated successfully, but these errors were encountered: