-
Notifications
You must be signed in to change notification settings - Fork 52
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
set atexit in mockupcamera #1169
base: develop
Are you sure you want to change the base?
Conversation
As of my knowledge, the only pids that are registered to this file are the |
37aca15
to
3788388
Compare
with open("/tmp/mxcube.pid", "a") as f: | ||
f.write("%s " % self._video_stream_process.pid) | ||
atexit.register(self.clean_up) |
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 now also modified the registration for the video-streamer in tangoLimaMPEGVideo
Looks like I still have some I do see the following message that did not seem to exist before though:
|
Yes, I added the message to make sure that the shutdown process is called. I do see that my changes have one issue: if the shutdown is not called when exiting the code, the processes will not be terminated (this is similar as it was before), however different than before it will not clean-up after processes that have been run on previous server runs and not terminated correctly, as there is no information left of old processes/there is no file anymore that keeps track. |
I checked again now:
The Is there a way to check if the We could also try to send |
Sending diff --git i/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py w/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py
index 853e40828..7f45a1311 100644
--- i/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py
+++ w/mxcubecore/HardwareObjects/mockup/MDCameraMockup.py
@@ -120,7 +120,7 @@ class MDCameraMockup(BaseHardwareObjects.HardwareObject):
def clean_up(self):
logging.getLogger("HWR").info("Shutting down video_stream...")
- os.kill(self._video_stream_process.pid, signal.SIGTERM)
+ os.kill(self._video_stream_process.pid, signal.SIGKILL)
def start_video_stream_process(self) -> None:
if ( I am not saying that is what we should do. In principle that should not be necessary. Sending |
Thanks for testing it @fabcor-maxiv :) You are right, it seems that I incorrectly tested
One could wait a few seconds, then use try:
os.kill(pid, 0)
print("process was still running")
except OSError:
print("no process detected") since |
I agree, however currently I will spend a little more time investigating the issue |
There was an issue regarding the correct shutdown of
video-streamer
processes in the MXCuBE-Web repository (see mxcube/mxcubeweb#1577) . A patch was introduced in the latest version ofvideo-streamer
that handles a signal catching issue (see mxcube/video-streamer#34).Until now, MXCuBE maintains a registry of spawned child processes in
/tmp/mxcube.pid
. However, themockupcamera
was never registered, which caused another issue for correct process termination. Additionally thetemp
file solution is violatingruff
rule S108.To solve this instead of registering the pid of the
video-streamer
process in a separate file, which will later be read by the server, this PR makes use of theatexit.register
functionality directly.Additionally, I moved the dependency of the
video-streamer
directly tomxcubecore
, since it is actually not directly used in the web but in the camera components.