- **status**: in-progress --> code-review
- **Comment**:
Truncating the error message in:
https://sourceforge.net/p/merciless/code/merge-requests/16/
Fixing the error checking in: db/7307
And here's an example showing the differences between pymongo and ming
exceptions:
~~~~
$ allurapaste shell /var/local/config/production.ini
>>> from ming.orm.ormsession import ThreadLocalORMSession
>>> from allura.model.notification import SiteNotification
>>> s = SiteNotification(content='\xab\xab') # invalid encoding, but easier to
>>> test than doc too large
>>> try:
... ThreadLocalORMSession.flush_all()
... except Exception as e:
... pass
...
# ming-fiddled exception
>>> str(e)
'(\'strings in documents must be valid UTF-8\', "doc: {\'active\': True,
\'content\': \'\\\\xab\\\\xab\', \'_id\':
ObjectId(\'533d76f4d8be357276af7b29\'), \'impressions\': 0}")'
>>> e.args
('strings in documents must be valid UTF-8', "doc: {'active': True, 'content':
'\\xab\\xab', '_id': ObjectId('533d74e1d8be35710fdeddb6'), 'impressions': 0}")
>>> e.args[0]
'strings in documents must be valid UTF-8'
# now compare to direct pymongo exception
>>> from pymongo.errors import InvalidDocument
>>> str(InvalidDocument('foobar'))
'foobar'
>>> InvalidDocument('foobar').args
('foobar',)
>>> str(InvalidDocument('foobar').args[0])
'foobar'
~~~~
---
** [tickets:#7307] Broken handling of InvalidDocument: BSON document too large**
**Status:** code-review
**Milestone:** forge-apr-4
**Created:** Thu Apr 03, 2014 02:54 PM UTC by Dave Brondsema
**Last Updated:** Thu Apr 03, 2014 02:54 PM UTC
**Owner:** Dave Brondsema
Ming "helpfully" adds the value of the current doc, when pymongo errors are
raised. In the case of docs that are too large, this puts a huge amount of
text on the error, which often gets written to a log file or saved back to
monq_task (which of course will fail again). Also, in our indexing code where
we know we're making big documents, and check for this case so we can split the
doc, the check is failing because of ming's slight change to the error object.
---
Sent from sourceforge.net because [email protected] is subscribed to
https://sourceforge.net/p/allura/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/allura/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.