https://bugzilla.redhat.com/show_bug.cgi?id=698771
We need to better handle the case where a server is shutdown while a long running task is active e.g. fixup-memberof. Tasks should check to see if the server is shutdown and gracefully exit. For some tasks that will leave the database in a inconsistent state, we could do one of two things: 1) the server will refuse to shutdown until all tasks are finished 2) the server will print an ugly error message to the log: "hey, you killed me before I could finish task X - the database will be in an inconsistent state until you let the task complete"
I could not reproduce a crash(like ticket 50), but the shutdown hangs until the task is complete. I have written a fix that exits out of plugin tasks when a shutdown is detected.
The plugins affected & modified are:
linkedattrs memberOf (Fixup task) usn
The memberOf plugin has many places where it can get "stuck" in loops. So this requires many checks for a shutdown event.
Preparing patch for review...
Mark
attachment 0001-Ticket-49-better-handling-for-server-shutdown-while-.patch
I ended up taking out some of the extra checks in memberOf, because some of those functions are used for post op operations. We want those ops to complete if there is a shutdown. Now I am seeing about a 9 second delay to shutdown the plugin with just a single check. With the extra unnecessary checks it was 4 - 5 seconds, so it's a but slower, but I believe it's the correct solution.
Looks ok, but at some point we should make g_get_shutdown a slapi function e.g. slapi_server_is_shutdown() or something like that, rather than have to expose an internal function to slapi.
Agreed, we should definitely make g_get_shutdown a slapi_function, as it was already being used in other plugins.
Fix is pushed:
[mareynol@mareynol servers]$ git merge ticket49 Updating 584dc80..1bde54d Fast-forward ldap/servers/plugins/linkedattrs/fixup_task.c | 79 +++++++++++++------------ ldap/servers/plugins/memberof/memberof.c | 15 ++++- ldap/servers/plugins/usn/usn_cleanup.c | 10 +++- 3 files changed, 63 insertions(+), 41 deletions(-)
[mareynol@mareynol servers]$ git push Counting objects: 21, done. Delta compression using up to 4 threads. Compressing objects: 100% (11/11), done. Writing objects: 100% (11/11), 1.67 KiB, done. Total 11 (delta 7), reused 0 (delta 0) To ssh://mreynolds@git.fedorahosted.org/git/389/ds.git 584dc80..1bde54d master -> master
Added initial screened field value.
Metadata Update from @rmeggins: - Issue assigned to mreynolds - Issue set to the milestone: 1.2.10.a7
389-ds-base is moving from Pagure to Github. This means that new issues and pull requests will be accepted only in 389-ds-base's github repository.
This issue has been cloned to Github and is available here: - https://github.com/389ds/389-ds-base/issues/49
If you want to receive further updates on the issue, please navigate to the github issue and click on subscribe button.
subscribe
Thank you for understanding. We apologize for all inconvenience.
Metadata Update from @spichugi: - Issue close_status updated to: wontfix (was: Fixed)
Login to comment on this ticket.