Opened 3 months ago

Closed 7 weeks ago

#33945 closed defect (fixed)

Failed assertion breaks BridgeDB's email responder

Reported by: phw Owned by: phw
Priority: High Milestone:
Component: Circumvention/BridgeDB Version:
Severity: Normal Keywords: s30-o22a2
Cc: cohosh, phw Actual Points: 0.5
Parent ID: #31279 Points: 2
Reviewer: Sponsor: Sponsor30-can

Description

BridgeDB's email responder stops working after a while. The issue is probably related to the exception below but I don't know how exactly. As part of our Python 3 port, we modifed the context manager, which may be a good place to start debugging.

Unhandled Error
Traceback (most recent call last):
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/python/log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/python/log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/internet/tcp.py", line 243, in doRead
    return self._dataReceived(data)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/protocols/basic.py", line 454, in dataReceived
    self.lineReceived(line)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/mail/smtp.py", line 445, in lineReceived
    return getattr(self, 'state_' + self.mode)(line)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/mail/smtp.py", line 705, in dataLineReceived
    m.eomReceived() for m in self.__messages
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/twisted/mail/smtp.py", line 705, in <listcomp>
    m.eomReceived() for m in self.__messages
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/bridgedb-0.10.0+11.g4cdd6a61.dirty-py3.7.egg/bridgedb/distributors/email/server.py", line 230, in eomReceived
    self.responder.reply()
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/bridgedb-0.10.0+11.g4cdd6a61.dirty-py3.7.egg/bridgedb/distributors/email/autoresponder.py", line 574, in reply
    response = self.getMailData()
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/bridgedb-0.10.0+11.g4cdd6a61.dirty-py3.7.egg/bridgedb/distributors/email/autoresponder.py", line 392, in getMailData
    client, lang)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/bridgedb-0.10.0+11.g4cdd6a61.dirty-py3.7.egg/bridgedb/distributors/email/autoresponder.py", line 101, in createResponseBody
    bridges = context.distributor.getBridges(bridgeRequest, interval)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/bridgedb-0.10.0+11.g4cdd6a61.dirty-py3.7.egg/bridgedb/distributors/email/distributor.py", line 145, in getBridges
    with bridgedb.Storage.getDB() as db:
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/bridgedb-0.10.0+11.g4cdd6a61.dirty-py3.7.egg/bridgedb/Storage.py", line 352, in __enter__
    return next(self.gen)
  File "/home/bridgedb/virtualenvs/bridgedb/lib/python3.7/site-packages/bridgedb-0.10.0+11.g4cdd6a61.dirty-py3.7.egg/bridgedb/Storage.py", line 472, in getDB
    assert _REFCOUNT == 0
builtins.AssertionError:

Child Tickets

Change History (6)

comment:1 Changed 2 months ago by phw

I have a work-in-progress fix, which I intend to deploy on polyanthum to see if it helps:
https://github.com/NullHypothesis/bridgedb/compare/develop...defect/33945

comment:2 Changed 2 months ago by phw

Keywords: s30-o22a2 added; s30-o22a3 removed

Moving this to activity 2 because it's not a localisation issue.

comment:3 Changed 7 weeks ago by phw

Status: assignedneeds_review

BridgeDB has been running on this patch for several days and its autoresponder hasn't crashed since. It's time to get it reviewed and merged.

comment:4 in reply to:  3 Changed 7 weeks ago by agix

Replying to phw:

BridgeDB has been running on this patch for several days and its autoresponder hasn't crashed since. It's time to get it reviewed and merged.

Looks good to me, let's merge it.

comment:5 Changed 7 weeks ago by agix

Status: needs_reviewmerge_ready

comment:6 Changed 7 weeks ago by phw

Actual Points: 0.5
Resolution: fixed
Status: merge_readyclosed

Thanks for the review! Merged in commit 5c0b04e.

Note: See TracTickets for help on using tickets.