You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even if there is not, that would not be a reason not to use it here. If I was writing a controller, I would always want to handle SIGTERM as it is the only thing that I can resonably expect to see before being killed, e.g. if the system is shutting down.
On windows we could (and maybe should) send_signal(CTRL_BREAK_EVENT).
How do you typically want to handle it? Install a signal handler that raises an exception (similar to KeyboardInterrupt) so that e.g. finally clauses are properly executed?
Note that clean shutdown is already possible with the current mechanism. Call terminate on the controller manager using artiq_rpctool in your system's shutdown scripts.
Who will write those scripts? SIGTERM is already there and is something that you see without any further work and without having to invent any further buggy scripts.
Also remember that terminate() relies on the entire networking stack working and the interface being up.
ARTIQ servers are always bound on localhost now in addition to any specified network address, so I do not think the network setup should be a problem.
SIGTERM is generally difficult to handle reliably (without race conditions) as it is asynchronous. Python messed it up. In addition Unix signals have subtle issues wrt the restarting of system calls. Do you really want to use SIGTERM as the recommended graceful process termination mechanism?
There is --no-localhost-bind... Why was that added anyway? I seem to have needed it because of some ITAC networking problems.
I would not use SIGTERM as the primary way (among other things it does not exist on Windows) but as a (non-ideal) fallback for the cases where I don't get a terminate().
Meh. Seems my usual pessimism about computers that gave me the idea to add that --no-localhost-bind option was totally justified. How did that happen though? It tries to bind on both 127.0.0.1 and ::1 by default, maybe there are systems on which binding a on v4 address also binds on the v6?
13 commit comments
sbourdeauducq commentedon Feb 1, 2016
Are there drivers that actually do something useful with SIGTERM on Linux?
jordens commentedon Feb 2, 2016
Even if there is not, that would not be a reason not to use it here. If I was writing a controller, I would always want to handle SIGTERM as it is the only thing that I can resonably expect to see before being killed, e.g. if the system is shutting down.
On windows we could (and maybe should)
send_signal(CTRL_BREAK_EVENT)
.sbourdeauducq commentedon Feb 2, 2016
How do you typically want to handle it? Install a signal handler that raises an exception (similar to
KeyboardInterrupt
) so that e.g.finally
clauses are properly executed?This adds boilerplate to every controller, and it's still an approximate solution as asynchronous exceptions in Python have races (http://dept.cs.williams.edu/~freund/papers/python.pdf).
sbourdeauducq commentedon Feb 2, 2016
Note that clean shutdown is already possible with the current mechanism. Call
terminate
on the controller manager usingartiq_rpctool
in your system's shutdown scripts.jordens commentedon Feb 2, 2016
Who will write those scripts?
SIGTERM
is already there and is something that you see without any further work and without having to invent any further buggy scripts.Also remember that
terminate()
relies on the entire networking stack working and the interface being up.sbourdeauducq commentedon Feb 2, 2016
ARTIQ servers are always bound on localhost now in addition to any specified network address, so I do not think the network setup should be a problem.
SIGTERM
is generally difficult to handle reliably (without race conditions) as it is asynchronous. Python messed it up. In addition Unix signals have subtle issues wrt the restarting of system calls. Do you really want to useSIGTERM
as the recommended graceful process termination mechanism?sbourdeauducq commentedon Feb 2, 2016
But I will concede that the ability to interrupt a blocking system call at all is an advantage for signals.
jordens commentedon Feb 2, 2016
There is
--no-localhost-bind
... Why was that added anyway? I seem to have needed it because of some ITAC networking problems.I would not use
SIGTERM
as the primary way (among other things it does not exist on Windows) but as a (non-ideal) fallback for the cases where I don't get aterminate()
.sbourdeauducq commentedon Feb 2, 2016
Essentially, it makes it easier to use clients when you are logged on the same machine as the server, as they work without any network options then.
jordens commentedon Feb 2, 2016
I was getting
address already in use
from the server without that option. Even though there was nothing using that port.sbourdeauducq commentedon Feb 2, 2016
Meh. Seems my usual pessimism about computers that gave me the idea to add that
--no-localhost-bind
option was totally justified. How did that happen though? It tries to bind on both 127.0.0.1 and ::1 by default, maybe there are systems on which binding a on v4 address also binds on the v6?jordens commentedon Feb 2, 2016
I'll look into it if I see it again. My guess would be IPv6 related in some way.
sbourdeauducq commentedon Feb 2, 2016
If that is the problem, we could bind on v6 only.