PyBorg icon indicating copy to clipboard operation
PyBorg copied to clipboard

Crash on regaining nickname on disconnect

Open bdrewery opened this issue 10 years ago • 1 comments

FROM SERVER: :[email protected] QUIT :Ping timeout: 240 seconds
command: quit, source: [email protected], target: None, arguments: ['Ping timeout: 240 seconds']
FROM SERVER: :irc.underworld.no 731 * :cutie578
command: monoffline, source: irc.underworld.no, target: *, arguments: ['cutie578']
Attempting to regain nickname cutie578
Traceback (most recent call last):
  File "../lib/pyborg/pyborg-irc.py", line 687, in 
    bot.our_start()
  File "../lib/pyborg/pyborg-irc.py", line 174, in our_start
    self.start()
  File "/usr/home/cutie578/PyBorg/lib/pyborg/ircbot.py", line 253, in start
    SimpleIRCClient.start(self)
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 1115, in start
    self.ircobj.process_forever()
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 230, in process_forever
    self.process_once(timeout)
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 215, in process_once
    self.process_data(i)
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 184, in process_data
    c.process_data()
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 601, in process_data
    self._handle_event(Event(command, prefix, target, arguments))
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 605, in _handle_event
    self.irclibobj._handle_event(self, event)
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 326, in _handle_event
    if handler[1](connection, event) == "NO MORE":
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 1050, in _dispatcher
    getattr(self, m)(c, e)
  File "../lib/pyborg/pyborg-irc.py", line 600, in on_monoffline
    self._try_regain(self.wanted_myname)
  File "../lib/pyborg/pyborg-irc.py", line 586, in _try_regain
    self.connection.nick(self.settings.myname)
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 734, in nick
    self.send_raw("NICK " + newnick)
  File "/usr/home/cutie578/PyBorg/lib/pyborg/irclib.py", line 786, in send_raw
    raise ServerNotConnectedError, "Not connected."
ServerNotConnectedError: Not connected.
Ooops! It looks like Pyborg has crashed. Would you like to save its dictionary? (y/n) Writing dictionary...

bdrewery avatar May 06 '15 20:05 bdrewery

This seems to be a race from sending a reply (via a thread in process_msg) and processing the QUIT.

The exception is when socket == None which without threads wouldn't be possible since it read from the socket fine (and didn't hit an EOF to trigger setting socket = None) to process the monoffline reply.

So it must have sent a reply right after reading the monoffline from the socket and before it sent NICK back to the server.

bdrewery avatar Sep 11 '15 18:09 bdrewery