noxrepo / pox

The POX network software platform
https://noxrepo.github.io/pox-doc/html/
Apache License 2.0
619 stars 470 forks source link

POX Controller goes down with "Exception reading connection None" when run in background #269

Closed AndreeaPocol closed 2 years ago

AndreeaPocol commented 2 years ago

I'm conducting research using Mininet and the POX controller running locally in the same VM. To this end, I'm trying to launch the POX controller as a background process from a Bash script but the controller just shuts down as soon as I launch it this way.

For troubleshooting purposes, I was able to reproduce the issue using the following simple Bash script.

I run:

#!/bin/bash

cd pox/
sudo ./pox.py --verbose py forwarding.l2_learning host_tracker openflow.discovery openflow.of_01 --port=6633 &
wait
echo "Done"

The output I get is:

mininet@mininet-vm:~$ sudo ./s.sh
mininet@mininet-vm:~$ POX 0.7.0 (gar) / Copyright 2011-2020 James McCauley, et al.
INFO:host_tracker:host_tracker ready
DEBUG:core:POX 0.7.0 (gar) going up...
DEBUG:core:Running on CPython (3.6.9/Jan 26 2021 15:33:00)
DEBUG:core:Platform is Linux-4.15.0-159-generic-x86_64-with-Ubuntu-18.04-bionic
WARNING:version:Support for Python 3 is experimental.
INFO:core:POX 0.7.0 (gar) is up.
DEBUG:openflow.of_01:Listening on 0.0.0.0:6633
Ready.
POX> 
INFO:core:Going down...
INFO:core:Down.
ERROR:openflow.of_01:Exception reading connection None
Traceback (most recent call last):
  File "/home/mininet/pox/pox/openflow/of_01.py", line 1084, in run
    rlist, wlist, elist = yield Select(sockets, [], sockets, 5)
GeneratorExit
DEBUG:openflow.of_01:No longer listening for connections
Done

How can I successfully launch the POX controller and keep it running until I'm ready to kill it?

Thank you.

MurphyMc commented 2 years ago

You're running the "py" component, which makes it interactive. But then you're not running it interactively, so it has no stdin, so it shuts down.

Just remove the "py" from your command line.

As a sidenote, you may be interested in the misc.pidfile component, which can make it easier to kill later.

MurphyMc commented 2 years ago

The other py in your commandline. :) The one following --verbose. That's the one which runs the "py" component.

AndreeaPocol commented 2 years ago

It just hit me haha! I'll try that, thanks.