pymemcache regression in SnapStoreClient.listChannels

Bug #1950811 reported by Colin Watson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Jürgen Gmach

Bug Description

After rolling out the switch to pymemcache (see https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/411523 etc.), Snap:+edit pages started failing as shown in OOPS-833516c4c933b7fc9971a0948ba38a37:

  TypeError: the JSON object must be str, not 'bytes'

    Traceback (most recent call last):
  Module zope.publisher.publish, line 146, in publish
    result = publication.callObject(request, obj)
  Module lp.services.webapp.publication, line 481, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  Module zope.publisher.publish, line 119, in mapply
    return debug_call(obj, args)
   - __traceback_info__: <security proxied zope.browserpage.simpleviewclass.SimpleViewClass from /srv/launchpad.net/production/launchpad-rev-580154009ac6a0d115932620120c2fecfad9a626/lib/lp/snappy/templates/snap-edit.pt instance at 0x7f60bcfb7ba8>
  Module zope.publisher.publish, line 126, in debug_call
    return obj(*args)
  Module lp.services.webapp.publisher, line 438, in __call__
    self.initialize()
  Module lp.app.browser.launchpadform, line 114, in initialize
    self.setUpWidgets()
  Module lp.snappy.browser.snap, line 937, in setUpWidgets
    super(SnapEditView, self).setUpWidgets(context)
  Module lp.snappy.browser.snap, line 735, in setUpWidgets
    super(BaseSnapEditView, self).setUpWidgets()
  Module lp.app.browser.launchpadform, line 214, in setUpWidgets
    ignore_request=False)
  Module zope.formlib.form, line 308, in setUpWidgets
    widget.setRenderedValue(field.get(adapter))
  Module lp.snappy.browser.widgets.storechannels, line 108, in setRenderedValue
    self.setUpSubWidgets()
  Module lp.snappy.browser.widgets.storechannels, line 80, in setUpSubWidgets
    self, field.__name__, field, IInputWidget, prefix=self.name)
  Module zope.formlib.utility, line 87, in setUpWidget
    widget = widget(field.bind(context), view.request)
  Module zope.schema._field, line 768, in bind
    clone.value_type = clone.value_type.bind(context)
  Module zope.schema._field, line 466, in bind
    vocabulary = clone.vocabulary = clone._resolve_vocabulary(None)
  Module zope.schema._field, line 450, in _resolve_vocabulary
    vocabulary = vr.get(self.context, self.vocabularyName)
  Module zope.vocabularyregistry.registry, line 60, in get
    return factory(context)
  Module lp.snappy.vocabularies, line 227, in __init__
    channels = getUtility(ISnapStoreClient).listChannels()
  Module lp.snappy.model.snapstoreclient, line 400, in listChannels
    channels = json.loads(cached_channels)
  Module json, line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

We rolled back due to the combination of this and a firewall issue that caused private PPA authentication to break (the latter is being fixed by IS).

Related branches

Revision history for this message
Colin Watson (cjwatson) wrote :

It seems that we were one upstream version behind on python-memcached, and that upstream version included https://github.com/linsomniac/python-memcached/pull/135, which added the flag to indicate that stored data corresponded to a text value. So we'll have to explicitly decode when we know that we expect to find text; I think that goes for most of our uses of memcache, except for `LaunchpadRootIndexView` which seems to store a pickled array (probably unintentionally as we normally prefer JSON to pickle whenever possible).

Jürgen Gmach (jugmac00)
Changed in launchpad:
status: Triaged → Fix Committed
Jürgen Gmach (jugmac00)
Changed in launchpad:
status: Fix Committed → Fix Released
Jürgen Gmach (jugmac00)
Changed in launchpad:
status: Fix Released → Fix Committed
Jürgen Gmach (jugmac00)
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.