etag header not reliable in HEAD requests

Bug #645342 reported by Michael Vogt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Software Center Agent
Fix Released
Undecided
Anthony Lenton

Bug Description

When testing my lp:~mvo/software-center/no-restfulclient-for-what-is-available/ branch I noticed that the etags header is not always returned:

$ curl -I https://software-center.ubuntu.com/apps/en/ubuntu/maverick/i386/
HTTP/1.1 200 OK
Date: Wed, 22 Sep 2010 15:46:34 GMT
Server: Apache/2.2.14 (Ubuntu)
ETag: "4278440f25214c811b8c6b176645e944"
Expires: Wed, 22 Sep 2010 15:48:07 GMT
Cache-Control: max-age=600
Last-Modified: Wed, 22 Sep 2010 15:38:07 GMT
Content-Type: application/json
Via: 1.1 software-center.ubuntu.com

$ curl -I https://software-center.ubuntu.com/apps/en/ubuntu/maverick/i386/
HTTP/1.1 200 OK
Date: Wed, 22 Sep 2010 15:46:39 GMT
Server: Apache/2.2.14 (Ubuntu)
Content-Type: application/json
Via: 1.1 software-center.ubuntu.com

It seems to be a bit random, maybe 1 out of 3 or 1 out of 4 times.

Michael Vogt (mvo)
Changed in software-center-agent:
milestone: none → 10.10
Michael Vogt (mvo)
summary: - etag header not reliable
+ etag header not reliable in HEAD requests
Revision history for this message
Anthony Lenton (elachuni) wrote :

Hi, this was due to the interaction of two django middlewares, CommonMiddleware and UpdateCacheMiddleware. As CommonMiddleware removes the content for HEAD requests before UpdateCacheMiddleware gets a chance to calculate the ETag header, you will only get an ETag header when you've recently made a GET request for the same URL, in which case the ETag header is already cached.

This was compounded by the fact that, having two app servers, the header was some times cached in one app server but not in the other.

I've changed the USE_ETAGS setting to True to have the CommonMiddleware always calculate the ETags header for every request, which solves the issue locally. We should test again once this config change has been deployed.

Changed in software-center-agent:
assignee: nobody → Anthony Lenton (elachuni)
status: New → Fix Committed
Revision history for this message
Michael Vogt (mvo) wrote :

This appears to be fixed now, I get consistent results now.

Revision history for this message
Dave Morley (davmor2) wrote :

This is displayed consistently in tests on staging

Changed in canonical-isd-qa:
status: New → Fix Committed
assignee: nobody → Dave Morley (davmor2)
Revision history for this message
Dave Morley (davmor2) wrote :

This is displayed consistently in Production.

Changed in canonical-isd-qa:
status: Fix Committed → Fix Released
Changed in software-center-agent:
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.