client disconnection on https rss feed update

Issue #31 new
Matt B created an issue

Sometimes when the plugin checks https rss feeds, it disconnects the thin client user. Have received different messages:

rpcserver:224 Deluge client disconnected: [('SSL routines', 'SSL3_READ_BYTES', 'tlsv1 alert protocol version')]

rpcserver:224 Deluge client disconnected: [('SSL routines', 'SSL3_WRITE_PENDING', 'bad write retry')]

This doesn't happen every time, so not sure why its random, but it happens the same second as an RSS reed update. Doesn't occur when feeds are disabled. Happens with three separate RSS feeds links on different sites.

Using latest 1.4.3 version, Deluge 1.3.12, Libtorrent 0.15.1.0, Python 2.7.3, Debian Wheezy

Comments (3)

  1. Matt B reporter

    Upgraded to debian 8, python 2.7.9, liborrent 0.16.8.0 -- still happens

    here is the traceback every time it happens, maybe someone can make sense of this. This may not be plugin issue and actually ssl issue?

    #!
    
    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 214, in doRead
        return self._dataReceived(data)
      File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 220, in _dataReceived
        rval = self.protocol.dataReceived(data)
      File "/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 422, in dataReceived
        self._flushReceiveBIO()
      File "/usr/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 360, in _flushReceiveBIO
        bytes = self._tlsConnection.recv(2 ** 15)
      File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 995, in recv
        self._raise_ssl_error(self._ssl, result)
      File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 862, in _raise_ssl_error
        raise SysCallError(errno, errorcode[errno])
    exceptions.KeyError: 0
    
  2. Bendik repo owner

    Hi

    I remember seeing this issue some time ago with a KeyError exception in SSL libs called from twisted. This is probably the issue: https://github.com/pyca/pyopenssl/issues/163

    This is probably one of the reasons the thin client disconnects, but it can also be due to other problems.

    To fix the KeyError issue without upgrading the library you can hack /usr/lib/python2.7/dist-packages/OpenSSL/SSL.py by changing the line (862) from raise SysCallError(errno, errorcode[errno]) to raise SysCallError(errno, errorcode.get(errno)) which is the fix applied to in later versions of pyopenssl.

    A better approach is to install a newer version of pyopenssl with pip.

  3. Matt B reporter

    I updated pyOpenSSL to 0.15.1 but I still get disconnections. I'm not getting any errors or warnings anymore though. Only message I get when the client disconnects is rpcserver:223 Deluge client disconnected: Connection to the other side was lost in a non-clean fashion: Connection lost. I don't get those SSL disconnect messages anymore, just the one above.

  4. Log in to comment