Repository navigation
CA-432805: Avoid fuse exit hanging in flush_all #7364
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,8 +42,21 @@ let once kind f = | |
| ) | ||
| ) | ||
|
|
||
| (* The exit may hang, and nothing else would kill the process if it did, so | ||
| add a timer that forces the process to exit. *) | ||
| let force_exit_after_grace ~fuse_length ret_code = | ||
| let wait = fuse_length +. !Constants.fuse_exit_grace in | ||
| try | ||
| ignore (Thread.create (fun () -> Thread.delay wait ; Unix._exit ret_code) ()) ; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could there be a log that xapi exited in an unintended way here? Or do we want to avoid hanging on the log as well?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logging on exit may also block in syslog, so I didn't add a log. |
||
| debug "%s: forcing exit %d if still running in %.0fs" __FUNCTION__ ret_code | ||
| wait | ||
| with e -> | ||
| warn "%s: could not start the exit timer: %s" __FUNCTION__ | ||
| (Printexc.to_string e) | ||
|
|
||
| let light_fuse_and_run ?(fuse_length = !Constants.fuse_time) () = | ||
| once `Exit @@ fun () -> | ||
| force_exit_after_grace ~fuse_length Xapi_globs.restart_return_code ; | ||
| debug | ||
| "light_fuse_and_run: calling Rrdd.backup_rrds to save current RRDs locally" ; | ||
| let delay_so_far = | ||
|
|
@@ -82,7 +95,7 @@ let light_fuse_and_run ?(fuse_length = !Constants.fuse_time) () = | |
| "Caught an exception flushing database (perhaps it hasn't been \ | ||
| initialised yet): %s; restarting immediately" | ||
| (ExnHelper.string_of_exn e) ; | ||
| exit Xapi_globs.restart_return_code | ||
| Unix._exit Xapi_globs.restart_return_code | ||
| ) | ||
| () | ||
| ) | ||
|
|
@@ -116,6 +129,7 @@ let light_fuse_and_reboot ?(fuse_length = !Constants.fuse_time) () = | |
|
|
||
| let light_fuse_and_dont_restart ?(fuse_length = !Constants.fuse_time) () = | ||
| once `Exit @@ fun () -> | ||
| force_exit_after_grace ~fuse_length 0 ; | ||
| ignore | ||
| (Thread.create | ||
| (fun () -> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the reason you select 60 for fuse_exit_grace?
The thread is created before stats stop and rrdd backup, is it intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked for the thread start to be moved above: #7364 (comment)