Daniel Ding <[email protected]> writes:

> After running ovs-tcpdump and inputs multiple CTRL+C, the program will
> raise the following exception.
>
> Error in atexit._run_exitfuncs:
> Traceback (most recent call last):
>   File "/usr/bin/ovs-tcpdump", line 421, in cleanup_mirror
>     ovsdb = OVSDB(db_sock)
>   File "/usr/bin/ovs-tcpdump", line 168, in __init__
>     OVSDB.wait_for_db_change(self._idl_conn)  # Initial Sync with DB
>   File "/usr/bin/ovs-tcpdump", line 155, in wait_for_db_change
>     while idl.change_seqno == seq and not idl.run():
>
> Signed-off-by: Daniel Ding <[email protected]>
> ---

LGTM for the linux side - maybe Alin might check the windows side.

When you post v2 you can keep my

Reviewed-by: Aaron Conole <[email protected]>

>  utilities/ovs-tcpdump.in | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
> index 4cbd9a5d3..eec2262d6 100755
> --- a/utilities/ovs-tcpdump.in
> +++ b/utilities/ovs-tcpdump.in
> @@ -17,6 +17,7 @@
>  import os
>  import pwd
>  from random import randint
> +import signal
>  import subprocess
>  import sys
>  import time
> @@ -417,8 +418,22 @@ def py_which(executable):
>                 for path in os.environ["PATH"].split(os.pathsep))
>  
>  
> +def ignore_fatal_signals():
> +    if sys.platform == "win32":
> +        signals = [signal.SIGTERM, signal.SIGINT]
> +    else:
> +        signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP,
> +                   signal.SIGALRM]
> +
> +    for signr in signals:
> +        signal.signal(signr, signal.SIG_IGN)
> +
> +

Just a nit, but it might be clearer to put the ignore_fatal_signals as a
function scoped in teardown below.  That way it is a bit clearer that
this will only be called to turn off these in the double failure case.

>  def teardown(db_sock, interface, mirror_interface, tap_created):
>      def cleanup_mirror():
> +        # Ignore fatal signals, avoid it to break OVSDB operations.
> +        # So that cleanup mirror and ports be finished.
> +        ignore_fatal_signals()
>          try:
>              ovsdb = OVSDB(db_sock)
>              ovsdb.destroy_mirror(interface, ovsdb.port_bridge(interface))

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to