Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure clean exit on KeyboardInterrupt #34

Closed
johnnykv opened this issue May 9, 2013 · 3 comments
Closed

ensure clean exit on KeyboardInterrupt #34

johnnykv opened this issue May 9, 2013 · 3 comments
Labels
Milestone

Comments

@johnnykv
Copy link
Member

johnnykv commented May 9, 2013

If SIGINT is thrown it does not get handled properly.

 Traceback (most recent call last):
  File "/Users/jkv/virtualenvs/conpot/bin/conpot", line 7, in <module>
    execfile(__file__)
  File "/Users/jkv/repos/conpot/bin/conpot", line 122, in <module>
    main()
  File "/Users/jkv/repos/conpot/bin/conpot", line 107, in main
    servers.append(gevent.spawn(snmp_server.start()))
  File "/Users/jkv/repos/conpot/conpot/snmp_server.py", line 47, in start
    self.snmp_server.serve_forever()
  File "/Users/jkv/repos/conpot/conpot/modules/snmp_command_responder.py", line 170, in serve_forever
    self.snmpEngine.transportDispatcher.serve_forever()
  File "/Users/jkv/virtualenvs/conpot/lib/python2.7/site-packages/gevent/baseserver.py", line 190, in serve_forever
    self._stopped_event.wait()
  File "/Users/jkv/virtualenvs/conpot/lib/python2.7/site-packages/gevent/event.py", line 74, in wait
    result = get_hub().switch()
  File "/Users/jkv/virtualenvs/conpot/lib/python2.7/site-packages/gevent/hub.py", line 164, in switch
    return greenlet.switch(self)
KeyboardInterrupt
@glaslos
Copy link
Member

glaslos commented May 9, 2013

Heh, that worked for me...

@glaslos
Copy link
Member

glaslos commented May 9, 2013

Doesn't this work?

try:
    main()
except KeyboardInterrupt:
    print "bye"

@johnnykv
Copy link
Member Author

johnnykv commented May 9, 2013

That would work yes, but i would like to ensure that the greenlets has a all nice and cosy shutdown.
Just figured the problem... committing now...

creolis pushed a commit that referenced this issue Jul 30, 2019
srenfo pushed a commit to srenfo/conpot that referenced this issue Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants