The problem is that NOX doesn't handle multiple threads in Python. The solution is to just scrap the thread. NOX already has a reactor running, so just set up your protocol and you should be good to go -- all you need is the following in the install() method: factory = Factory() factory.protocol = QOTD reactor.listenTCP(8007, factory)
-- Murphy On Nov 21, 2010, at 11:57 PM, Derek Cormier wrote: > Hello, > > I am trying to run a thread inside of a python NOX component using twisted > that listens for TCP connections. I added code to pyswitch.py to see if I > could get it working. However, I am getting this seg fault from NOX. It seems > to be failing at 'reactor.listenTCP(8007, factory)'. Any ideas on what the > problem might be? > > Added code: > > class ServerThread(Thread): > def run(self): > print "Thread started" > factory = Factory() > factory.protocol = QOTD > reactor.listenTCP(8007, factory) > reactor.run() > > class QOTD(LineReceiver): > def connectionMade(self): > self.transport.write("Vene, vidi, vici\n") > self.transport.loseConnection() > > I added the following two lines at the end of pyswitch's install method: > > self.serverThread = ServerThread() > self.serverThread.start() > > NOX Output: > > NOX 0.9.1~full~beta (nox_core), compiled Nov 11 2010 10:38:11 > Compiled with OpenFlow 0x01 > Thread started > Caught signal 11. > 0x7f47a8541262 64 (vigil::fault_handler(int)+0x42) > 0x7f47a79d5af0 > 0x7f47a85a206b 64 (vigil::co_fsm_run(vigil::co_thread*)+0x4b) > 0x7f47a4cddc83 > 0x7f47a4ce193c > 0x7f47a4ce1f1a > 0x7f47a6610313 18446604128078702928 (PyEval_EvalFrameEx+0x5483) > 0x7f47a6969440 18446744073666775329 (PyFrame_Type+0x0) > Segmentation fault > > > Thanks, > -Derek > > _______________________________________________ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org _______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org