Lists of strings result in inconsistent ETags between Python 2 and 3

Bug #1928474 reported by Andy Whitcroft
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Colin Watson
lazr.restful
Fix Released
Critical
Colin Watson

Bug Description

We have had a major increase in PreconditionFailed errors from a regular process run. While this is idempotent against them the number of these errors has gone from 0 on an average day to one in nearly every 5m-ly run.

It is suspected we are getting different ETags for the same representation leading to these errors:

--- 1 2021-05-14 15:07:55.295802689 +0100
+++ 2 2021-05-14 15:07:46.863724112 +0100
@@ -12,7 +12,7 @@
   "duplicate_of_link": null,
   "duplicates_collection_link": "https://api.launchpad.net/devel/bugs/1927621/duplicates",
   "heat": 12,
- "http_etag": "\"492a964f1cf2270a6cd5fad5a1da781d4700f3e8-1088bdfbc0ce82cf4d6e08517657386465664266\"",
+ "http_etag": "\"492a964f1cf2270a6cd5fad5a1da781d4700f3e8-4cbb77fac29d65ce02630078c00e1e7e00b4ae5e\"",
   "id": 1927621,
   "information_type": "Public",
   "latest_patch_uploaded": null,

Related branches

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

I think this is a Python 3 dict ordering bug.

Changed in lazr.restful:
assignee: nobody → Colin Watson (cjwatson)
importance: Undecided → Critical
status: New → In Progress
Revision history for this message
Colin Watson (cjwatson) wrote :

In fact it's because the list of tags on a bug is serialized for ETag purposes as `[u'foo', u'bar', u'baz']` on Python 2, but as `['foo', 'bar', 'baz']` on Python 3.

summary: - sudden flurry of PreconditionFailed errors from unchanged processing
+ Lists of strings result in inconsistent ETags between Python 2 and 3
Colin Watson (cjwatson)
Changed in lazr.restful:
status: In Progress → Fix Committed
Revision history for this message
Colin Watson (cjwatson) wrote :

Fixed in lazr.restful 1.0.3.

Changed in launchpad:
status: New → Triaged
importance: Undecided → Critical
Changed in lazr.restful:
status: Fix Committed → Fix Released
Colin Watson (cjwatson)
Changed in launchpad:
status: Triaged → In Progress
assignee: nobody → Colin Watson (cjwatson)
Changed in launchpad:
status: In Progress → 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.