Open bgottula opened 3 years ago
Today I've been having this problem, but it's worse than usual because nearly every time I have to end the program with a second CTRL-C, the two forked processes continue running and I have to hunt them down and kill them manually. Not sure what is different because I don't think I have typically needed to do this extra step.
I should be able to help with this.
I have lots of experience in the area of planning and executing the premeditated murder of CPU processes that have overstayed their welcome. 😉
Give me a call whenever, and I'll see what I can come up with.
With lots of print statements sprinkled around:
^CGot CTRL-C, shutting down...
Safing mount...stop motion called
called slew() with rate 0 on both axes, waiting on events
RA axis event is set
DEC axis event is set
returning from stop_motion()
Mount safed successfully!
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/popen_fork.py", line 28, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
In Gemini2 destructor
In Gemini2 destructor: ra process is alive, sending None to pipe
In Gemini2 destructor: dec process is alive, sending None to pipe
Finished sending None to both axis processes
Joining process for ra axis
rate_target is None for ra, setting div_target to 0 and shutdown to True
rate_target is None for dec, setting div_target to 0 and shutdown to True
shutdown == True for ra
div_last_commanded == 0, returning from ra
shutdown == True for dec
div_last_commanded == 0, returning from dec
Join returned for ra
Joining process for dec axis
Join returned for dec
returning from Gemini2 destructor
Had a call with @jgottula on 18 Jan 2021 where we discussed this in depth. Some of the main conclusions we came to are:
I think it would be best to pursue feasibility of ditching multiprocessing before investing much more effort into fixing this particular issue. In the event that we are stuck with it, @jgottula suggested a couple things:
exec_cmd()
and exec_cmds()
, if in multiprocessing mode, wrap in a multiprocessing.Lock()
. We may just be getting lucky that context switches are not happening right in the middle of this backend processing. This probably wouldn't fix the issue here though.
Not sure if the problem is in this project or in point, but I frequently need to CTRL-C twice to end the program (but not always). When I need to do it twice I get the following:
After the first CTRL-C, I see the messages "Got CTRL-C, shutting down..." and "Safing mount...Mount safed successfully!" and I'm fairly confident that the mount motion is indeed stopped, though I'm not certain since I usually stop the program when the mount is not moving at a rate that is noticeable. The console messages after that are emitted after the second time I press CTRL-C, which finally ends the program and brings me back to the terminal.
We've encountered numerous versions of this problem over the years, so check the issue history for some insights.