← Back to team overview

launchpad-dev team mailing list archive

Re: Shortlist limit exceeded on Language page

 

On Wed, 2010-03-31 at 19:19 +0700, Jeroen Vermeulen wrote:
> David got an oops the other day while posting the admin form for a 
> language (taken from OOPS-1550O2497):
> 
>    ShortListTooBigError: Hard limit of 1000 exceeded.
> 
>      Traceback (most recent call last):
>    Module zope.publisher.publish, line 134, in publish
>    Module canonical.launchpad.webapp.publication, line 426, in callObject
>      return mapply(ob, request.getPositionalArguments(), request)
>    Module zope.publisher.publish, line 109, in mapply
>     - __traceback_info__: <security proxied 
> zope.browserpage.metaconfigure.SimpleViewClass from 
> /srv/launchpad.net/production/launchpad-rev-9095/lib/lp/translations/browser/../../app/templates/generic-edit.pt 
> instance at 0x2aaac360ce10>
>    Module zope.publisher.publish, line 115, in debug_call
>    Module canonical.launchpad.webapp.publisher, line 278, in __call__
>      self.initialize()
>    Module canonical.launchpad.webapp.launchpadform, line 110, in initialize
>      self.form_result = action.success(data)
>    Module zope.formlib.form, line 606, in success
>    Module lp.translations.browser.language, line 279, in admin_action
>      self.updateContextFromData(data)
>    Module canonical.launchpad.webapp.launchpadform, line 397, in 
> updateContextFromData
>      context, providing=providedBy(context))
>    Module lazr.lifecycle.snapshot, line 90, in __init__
>    Module zope.component._api, line 104, in queryAdapter
>    Module zope.site.hooks, line 95, in adapter_hook
>    Module canonical.launchpad.webapp.snapshot, line 22, in 
> snapshot_sql_result
>      return shortlist(value, longest_expected=100, hardlimit=1000)
>    Module canonical.launchpad.helpers, line 352, in shortlist
>      'Hard limit of %d exceeded.' % hardlimit)
> ShortListTooBigError: Hard limit of 1000 exceeded.
> 
> This happened with Spanish, which is obviously a pretty "big" language. 
>   But I doubt the number of countries it's spoken in will have broken 
> through the limit of 1,000.
> 
> ISTRM the API breaking sometimes when lists got too long...  could it be 
> the number of people interested in a language that exceeds this limit? 
> If so, why is it being queried in the first place?

I think the issue is in the interface, not shortlist. Snapshot is doing
a deep copy of the the Language, and the linked objects. This inherently
wrong in many cases where the linked objects are a list that could not
have been modified by the user...we should only snapshot the object
being changed, not the ancillary objects.

You can address this by annotating the interface:

    from lazr.lifecycle.snapshot import doNotSnapshot
...
    exported(
            doNotSnapshot(
                Collection

-- 
__Curtis C. Hovey_________
http://launchpad.net/

Attachment: signature.asc
Description: This is a digitally signed message part


References