Hi,

As you said, Ryu does not catch explicitly catch KeyboardInterrupt,
but Ryu closes Ryu`s application at 'finally' statement,
so we don't have to catch it explicitly, I think.
   https://github.com/osrg/ryu/blob/master/ryu/cmd/manager.py#L100-L101


FYI, you can test it as follows.

$ git diff
diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py
index b1ce8da..1c874f8 100755
--- a/ryu/cmd/manager.py
+++ b/ryu/cmd/manager.py
@@ -98,6 +98,7 @@ def main(args=None, prog=None):
      try:
          hub.joinall(services)
      finally:
+        print('Close applications.')
          app_mgr.close()


$ ryu-manager
loading app ryu.controller.ofp_handler
instantiating app ryu.controller.ofp_handler of OFPHandler
^CClose applications.                # !!! Ryu catches exception here
Traceback (most recent call last):
...
...


Thanks,
Iwase

On 2016年07月15日 19:18, alan_ford...@keysight.com wrote:
> Hi All,
>
>
>
> Can anyone suggest a fix for this issue?
>
>
>
> Thanks,
>
> Alan.
>
>
>
> *From:* FORDYCE,ALAN (K-Scotland,ex1)
> *Sent:* Friday, June 24, 2016 7:42 AM
> *To:* 'ryu-devel@lists.sourceforge.net' <ryu-devel@lists.sourceforge.net>
> *Subject:* KeyboardInterrupt (ctrl-c) and RYU
>
>
>
> Hi All,
>
>
>
> I am new to RYU having previously been using POX as my SDN Controller. One of 
> the first things that I’ve noticed when running RYU from my linux command 
> line is that when I quit RYU with Ctrl-C I get the following exception 
> reported back…
>
>
>
> [root@localhost bin]# /usr/local/bin/ryu-manager
>
> loading app ryu.controller.ofp_handler
>
> instantiating app ryu.controller.ofp_handler of OFPHandler
>
> ^CTraceback (most recent call last):
>
>   File "/usr/local/bin/ryu-manager", line 11, in <module>
>
>     sys.exit(main())
>
>   File "/usr/local/lib/python2.7/site-packages/ryu/cmd/manager.py", line 99, 
> in main
>
>     hub.joinall(services)
>
>   File "/usr/local/lib/python2.7/site-packages/ryu/lib/hub.py", line 97, in 
> joinall
>
>     t.wait()
>
>   File "/usr/local/lib/python2.7/site-packages/eventlet/greenthread.py", line 
> 175, in wait
>
>     return self._exit_event.wait()
>
>   File "/usr/local/lib/python2.7/site-packages/eventlet/event.py", line 121, 
> in wait
>
>     return hubs.get_hub().switch()
>
>   File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 
> 294, in switch
>
>     return self.greenlet.switch()
>
>   File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 
> 346, in run
>
>     self.wait(sleep_time)
>
>   File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/poll.py", line 
> 85, in wait
>
>     presult = self.do_poll(seconds)
>
>   File "/usr/local/lib/python2.7/site-packages/eventlet/hubs/epolls.py", line 
> 62, in do_poll
>
>     return self.poll.poll(seconds)
>
> KeyboardInterrupt
>
> [root@localhost bin]#
>
>
>
> RYU doesn’t appear to have any handling for the KeyboardInterrupt signal. Is 
> this correct or is there a better way to shutdown RYU? I’d rather not see an 
> exception on program close.
>
>
>
> Regards,
>
> Alan.
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity planning
> reports.http://sdm.link/zohodev2dev
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to