collective / collective.logbook

Advanced exception logging for Plone
5 stars 2 forks source link

Error in unknown conditions: TypeError: Can't pickle objects in acquisition wrappers #17

Closed rafaelbco closed 6 years ago

rafaelbco commented 6 years ago

Sometimes in my production site I see messages in the Zope event log stating that collective.logbook was unable to save an entry in the persistent error log, due to a TypeError: Can't pickle objects in acquisition wrappers (full message bellow).

I was not able to figure out the exact conditions for this to occur. However I figured out how to fix the issue and I'll send a PR.

2018-07-15T14:18:04 ERROR Zope.SiteErrorLog 1531675084.710.351352039281 
[redacted...]
------
2018-07-15T14:18:04 INFO collective.logbook handle traceback [[redacted]/error_log/showEntry?id=1531675084.710.351352039281]
------
2018-07-15T14:18:05 INFO collective.logbook ***** Notify new traceback 1531675084.710.351352039281
------
2018-07-15T14:18:05 INFO collective.logbook Sending Email to [redacted]
------
2018-07-15T14:18:05 WARNING collective.logbook An error occured while handling the traceback
------
2018-07-15T14:18:05 WARNING collective.logbook Can't pickle objects in acquisition wrappers.
------
2018-07-15T14:18:05 ERROR collective.logbook Can't pickle objects in acquisition wrappers.
Traceback (most recent call last):
  File "/home/ploneadmin/.buildout/eggs/collective.logbook-0.9.0-py2.7.egg/collective/logbook/events.py", line 81, in handleTraceback
    transaction.commit()
  File "/home/ploneadmin/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_manager.py", line 89, in commit
    return self.get().commit()
  File "/home/ploneadmin/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 329, in commit
    self._commitResources()
  File "/home/ploneadmin/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 443, in _commitResources
    rm.commit(self)
  File "/home/ploneadmin/.buildout/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 567, in commit
    self._commit(transaction)
  File "/home/ploneadmin/.buildout/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 623, in _commit
    self._store_objects(ObjectWriter(obj), transaction)
  File "/home/ploneadmin/.buildout/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 658, in _store_objects
    p = writer.serialize(obj)  # This calls __getstate__ of obj
  File "/home/ploneadmin/.buildout/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 422, in serialize
    return self._dump(meta, obj.__getstate__())
  File "/home/ploneadmin/.buildout/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 431, in _dump
    self._p.dump(state)
TypeError: Can't pickle objects in acquisition wrappers.
rafaelbco commented 6 years ago

@ramonski would please make a new release? Also, I forgot to add an entry to the changelog.

ramonski commented 6 years ago

Of course @rafaelbco! However, I would like to fix that email formatting issue as well https://github.com/collective/collective.logbook/issues/16, but not sure when I find some time for it. In the meantime I added you to PyPI as well. If you have some time, go ahead and do the 0.9.1 release. Otherwise I'll do it as soon as possible;)

rafaelbco commented 6 years ago

I've just made the release to PyPI. Thanks!