Opened 16 years ago

Closed 16 years ago

#1486 defect closed fixed (fixed)

AttributeError: 'NoneType' object has no attribute 'connectionLost'

Reported by: miro Owned by:
Priority: highest Milestone:
Component: conch Keywords:
Cc: Jean-Paul Calderone, miro, itamarst, therve Branch:
Author:

Description


Attachments (1)

sshserver.py (5.0 KB) - added by miro 16 years ago.

Download all attachments as: .zip

Change History (8)

Changed 16 years ago by miro

Attachment: sshserver.py added

comment:1 Changed 16 years ago by miro

sshserver.py from "Twisted Network Programming Essentials"
throws AttributeError when run on Fedora Core 4
after invoking terminal.looseConnection()
witin a class that extends recvline.HistoricRecvLine.

Same code runs fine on windows (W2K).

Environment on both systems:
Python 2.4.1 with latest Twisted (2.2) and Conch (0.6.0).

sshserver source attached, see trace below.

Miro

[miro@t42 ch10]$ python sshserver.py
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 59, in
callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 37, in
callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/service.py", line 42,
in packetReceived
    f(packet)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/connection.py", line
139, in ssh_CHANNEL_DATA
    log.callWithLogger(channel, channel.dataReceived, data)
--- <exception caught here> ---
  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line 58, in
callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line 43, in
callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 59, in
callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 37, in
callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/session.py", line
107, in dataReceived
    self.client.transport.write(data)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/session.py", line
154, in write
    self.proto.dataReceived(data)
  File "/usr/lib/python2.4/site-packages/twisted/conch/insults/insults.py", line
390, in dataReceived
    self.terminalProtocol.keystrokeReceived(ch, None)
  File "/usr/lib/python2.4/site-packages/twisted/conch/recvline.py", line 191,
in keystrokeReceived
    m()
  File "/usr/lib/python2.4/site-packages/twisted/conch/recvline.py", line 320,
in handle_RETURN
    return RecvLine.handle_RETURN(self)
  File "/usr/lib/python2.4/site-packages/twisted/conch/recvline.py", line 249,
in handle_RETURN
    self.lineReceived(line)
  File "sshserver.py", line 43, in lineReceived
    if not quitting: self.showPrompt()
  File "sshserver.py", line 21, in showPrompt
    self.terminal.write("$ ")
  File "/usr/lib/python2.4/site-packages/twisted/conch/insults/insults.py", line
687, in write
    self.transport.write(lines[0])
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/session.py", line
203, in write
    self.session.write(data)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/channel.py", line
163, in write
    self.loseConnection() # try again
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/session.py", line
129, in loseConnection
    self.client.transport.loseConnection()
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/session.py", line
160, in loseConnection
    self.proto.connectionLost(protocol.connectionDone)
  File "/usr/lib/python2.4/site-packages/twisted/conch/insults/insults.py", line
706, in connectionLost
    self.terminalProtocol.connectionLost(reason)
exceptions.AttributeError: 'NoneType' object has no attribute 'connectionLost'
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 59, in
callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 37, in
callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/service.py", line 42,
in packetReceived
    f(packet)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/connection.py", line
166, in ssh_CHANNEL_CLOSE
    log.callWithLogger(channel, channel.closeReceived)
--- <exception caught here> ---
  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line 58, in
callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/log.py", line 43, in
callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 59, in
callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/twisted/python/context.py", line 37, in
callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/channel.py", line
129, in closeReceived
    self.loseConnection()
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/session.py", line
129, in loseConnection
    self.client.transport.loseConnection()
  File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/session.py", line
160, in loseConnection
    self.proto.connectionLost(protocol.connectionDone)
  File "/usr/lib/python2.4/site-packages/twisted/conch/insults/insults.py", line
706, in connectionLost
    self.terminalProtocol.connectionLost(reason)
exceptions.AttributeError: 'NoneType' object has no attribute 'connectionLost'

comment:2 Changed 16 years ago by Jean-Paul Calderone

Which real-world event precipitates this traceback? The user typing "quit"? I haven't managed to reproduce this so far. I'll see if I can find a FC4 box to test it on.

comment:3 Changed 16 years ago by miro

Correct. You should be able to reproduce it by typing "quit" on FC4. I suspect the behavior should be the same on other similar Linux flavors.

comment:4 Changed 16 years ago by Jean-Paul Calderone

Cc: itamarst therve added
Owner: Jean-Paul Calderone deleted

I still can't reproduce this. I'm going to need some help to deal with this issue.

comment:5 Changed 16 years ago by therve

I can't reproduce it either (Ubuntu Dapper and Debian Etch).

By looking at the traceback, I don't see how can this still happen: it was fixed in [13542]. It should have been resolved.

comment:6 Changed 16 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

Cool. Miro sent me an email saying he also couldn't reproduce it on a more recent system or with a more recent Twisted.

comment:7 Changed 11 years ago by <automation>

Note: See TracTickets for help on using tickets.