Opened 10 years ago

Closed 10 years ago

#2709 closed bug (Fixed)

Deluged: object has no attribute '_tlsConnection'

Reported by: TheForumTroll Owned by:
Priority: major Milestone: not applicable
Component: Core Version: 1.3.11
Keywords: Cc:

Description (last modified by Calum)

Problem: Deluge daemon stops being accessible from the client and outputs errors to the console.

OS (server): Ubuntu 14.04 x86_64 (fully updated) OS (client): Windows 7 (fully updated) Deluge 1.3.11 (both server and client) libtorrent: 0.16.17.0

Further description: When trying to add torrents to deluge daemon (from deluge in Windows 7) often there is no connection to the daemon. Looking at the server console I have lots of errors in the console. Deluge daemon is still seeding but is not accessible from a client and has to be restarted.

Console errors are as follows:

Attaching: [tmux____1]

Sending variable: ['tmux', 'setenv', '-t', '1', 'XDG_SESSION_COOKIE', '036806ab9                                                                                                                                                             af866d3ed70178e528cf037-1417644864.833880-1816504446']
    why = selectable.doRead()
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 1070, in doRead
    protocol.makeConnection(transport)
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 295, in makeConnection
    tlsContext = self.factory._contextFactory.getContext()
  File "/usr/lib/python2.7/dist-packages/deluge/core/rpcserver.py", line 136, in getContext
    ctx.use_certificate_file(os.path.join(ssl_dir, "daemon.cert"))
OpenSSL.SSL.Error: [('system library', 'fopen', 'No such file or directory'), ('BIO routines', 'FILE_CTRL', 'system lib'), ('SSL routines', 'SSL_CTX_use_certificate_file', 'system lib')]
Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 88, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 73, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in doRead
    return self._dataReceived(data)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 221, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 403, in dataReceived
    self._tlsConnection.bio_write(bytes)
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/policies.py", line 114, in __getattr__
    return getattr(self.transport, name)
exceptions.AttributeError: 'NoneType' object has no attribute '_tlsConnection'
Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/deluge/core/daemon.py", line 171, in __init__
    reactor.run()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1192, in run
    self.mainLoop()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1204, in mainLoop
    self.doIteration(t)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 396, in doPoll
    log.callWithLogger(selectable, _drdw, selectable, fd, event)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 88, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 73, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 627, in _doReadOrWrite
    self._disconnectSelectable(selectable, why, inRead)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 263, in _disconnectSelectable
    selectable.connectionLost(failure.Failure(why))
  File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 299, in connectionLost
    protocol.connectionLost(reason)
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 461, in connectionLost
    self._tlsConnection.bio_shutdown()
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/policies.py", line 114, in __getattr__
    return getattr(self.transport, name)
exceptions.AttributeError: 'NoneType' object has no attribute '_tlsConnection'

Change History (9)

comment:1 by Calum, 10 years ago

Description: modified (diff)
Milestone: 1.3.x

This does not look like a Deluge related error. Can you verify that the daemon.cert is in your config as that seems to be the root of the error.

comment:2 by TheForumTroll, 10 years ago

I'm not sure exactly what you are asking. It is deluge giving the error and deluge stops working. There is such a file in ~/.config/deluge/ssl together with a daemon.pkey. It isn't mentioned in core.conf.

comment:3 by Calum, 10 years ago

There is a difference between a problem in Deluge code and external issue (operating system, libraries etc..) out with our control. From the details you have provided there is no evidence of any issue with Deluge code itself so there is nothing to fix in Deluge. One final factor is that we are not seeing this issue on our Ubuntu systems nor have any other users reported it.

OpenSSL.SSL.Error: [('system library', 'fopen', 'No such file or directory'), ('BIO routines', 'FILE_CTRL', 'system lib'), ('SSL routines', 'SSL_CTX_use_certificate_file', 'system lib')]

This initial error shows there is a problem reading the cert from disk so you need to investigate why, starting with permissions and verifying the location of the config loaded by deluged.

Last edited 10 years ago by Calum (previous) (diff)

comment:4 by Calum, 10 years ago

Component: Coreother/unknown
Milestone: 1.3.xnot applicable
Priority: criticalmajor
Status: newpending

comment:5 by TheForumTroll, 10 years ago

I'm not sure I can follow your train of thought. Let me try to explain it better:

I launch Deluge. It sometimes run for days, downloading and uploading perfectly, other times for hours at most. Suddenly there is a loss of access to it from a client -but not peers- and the console has lots of errors.

It seems to boil down to this:

  • It is a bug in Ubuntu/twisted/python that cause Deluge to show these symptoms.
  • Deluge's permissions are changed and then changed back when deluge is restarted (how?)
  • Deluge runs without using the cert but then suddenly don't (what is it for and why is it not used all the time?)

Either way I can't see how this is good behaviour by Deluge. Something is off in my opinion, even if the bug isn't in Deluge alone. What is the certificate for since it is only used some of the time? Encryption is forced, full all the time. Turning it off makes no difference.

EDIT: I see you have added to your reply since I read it on mail:

"One final factor is that we are not seeing this issue on our Ubuntu systems nor have any other users reported it."

I have not changed anything manually in deluge. Where is the config you want me to verify the location off? Core.conf is in the .config/deluge folder and has no mention of any certificate.

Last edited 10 years ago by TheForumTroll (previous) (diff)

comment:6 by Calum, 10 years ago

Config refers to the deluge config dir, I never mentioned core.conf, I simply asked if the daemon.cert (certificate) file was in your config (because if you look at the trace that is the file it cannot find) and you confirmed that it existed. This has nothing to do torrent encryption, this is about initiating encryption for client communication, hence why your clients cannot connect to the daemon.

What more do you expect me to do?

comment:7 by TheForumTroll, 10 years ago

"I never mentioned core.conf"

No but you said:

"... you need to investigate why, starting with permissions and verifying the location of the config loaded by deluged."

The "config file" is ~/.config/deluge/core.conf as far as I know. Besides, I did not set up this cert. Deluge did. How am I supposed to know where the problem lies? All I can tell is that Deluge installed a file, the file is still there but deluge cannot see it after running for some time. It can maybe 90 % of the time, but not all the time.

Changing permissions to 777 changed nothing by the way. The file is not mentioned anywhere I can see. Where is it you think it should be mentioned?

Last edited 10 years ago by TheForumTroll (previous) (diff)

comment:8 by Calum, 10 years ago

I'm afraid you are misreading/misinterpreting/making assumptions about the advice I have offered. Please can you read these sites about bug reporting Smart questions and Report Bugs Effectively. Then if you have new evidence on how to replicate the issue or pertinent information about your setup then feel free update the ticket.

comment:9 by TheForumTroll, 10 years ago

Component: other/unknownCore
Resolution: Fixed
Status: pendingclosed

I fixed it myself in daemon.py. You seem angry so I'll leave you alone. Thanks for helping.

Note: See TracTickets for help on using tickets.