Issue #32 invalid

Large DCC spam crashes bot

Anonymous created an issue

When in a DCC chat with our logbot (source: http://code.google.com/p/bitfighter/source/browse/?repo=tools#hg%2Fbitfighter-logbot), the main thread in the bot will fully crash. Here is the stack trace:

  File "main.py", line 280, in main
    bot.our_start()
  File "main.py", line 64, in our_start
    self.start()
  File "bitfighter-logbot/irc/bot.py", line 266, in start
    super(SingleServerIRCBot, self).start()
  File "bitfighter-logbot/irc/client.py", line 1225, in start
    self.ircobj.process_forever()
  File "bitfighter-logbot/irc/client.py", line 267, in process_forever
    self.process_once(timeout)
  File "bitfighter-logbot/irc/client.py", line 248, in process_once
    self.process_data(i)
  File "bitfighter-logbot/irc/client.py", line 213, in process_data
    c.process_data()
  File "bitfighter-logbot/irc/client.py", line 1124, in process_data
    Event(command, prefix, target, arguments))
  File "bitfighter-logbot/irc/client.py", line 387, in _handle_event
    result = handler.callback(connection, event)
  File "bitfighter-logbot/irc/client.py", line 1184, in _dispatcher
    method(connection, event)
  File "main.py", line 182, in on_dccmsg
    c.privmsg("You said: " + e.arguments[0])
  File "bitfighter-logbot/irc/client.py", line 1135, in privmsg
    return self.send_bytes(bytes)
  File "bitfighter-logbot/irc/client.py", line 1142, in send_bytes
    self.socket.send(bytes)
AttributeError: 'NoneType' object has no attribute 'send'

self.socket is ends up NULL if too much data is pasted for some reason

Comments (3)

  1. Jason R. Coombs repo owner

    If self.socket is None, that's because the 'disconnect' method was called, probably due to an error on the socket in DCCConnection.process_data. Unfortunately, the nature of the error is discarded, so the first step is going to be to add some logging there.

  2. Jason R. Coombs repo owner

    After further investigation, and based on your report, I believe the issue arises when more than 16k of data is sent without a newline in a DCC Chat session, it triggers a disconnect (with a non-helpful "Bad peer! Naughty peer!" comment in the code). In 576fd2d6df26, I've added some logging when that occurs that might at least verify my suspicion that this is the cause.

    Can you run with the latest (unreleased) IRC code and see if your server reports a log message when that occurs?

    I'm not sure why there's a 16k limit on messages. Maybe it's part of the spec or maybe the author just assumed a 16k limit, so even if you confirm this is the cause, more investigation will need to be done to better understand the rationale.

  3. Jason R. Coombs repo owner

    I'm unable to replicate the issue, so with no follow-up response, I'm closing this issue. If you have additional detail or can help me replicate the issue, please do add more detail and I will gladly re-open.

  4. Log in to comment