network disk cache does not take into account the HTTP Vary header

Bug #1575744 reported by Albert Astals Cid
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
Medium
John McAleely
qtbase-opensource-src (Ubuntu)
Confirmed
Medium
Unassigned
unity-scope-click (Ubuntu)
Fix Released
Medium
Paweł Stołowski

Bug Description

Switching from English to Polish works as expected
But then going back to English leaves me with store in Polish

This survives reboots.

Steps to reproduce:
1. Go to Ubuntu Store scope (with your current language).
2. Go to phone settings, change the language, accept & reboot the phone.
3. Go to Ubuntu Store scope. Note how scope title and some strings such as "installed" changed for the new language (since these are provided locally by the scope for current LANG), but strings such as 'Highlight of the week' or departments names (hit the search lens icon to reveal departments) which come from the store still use the old language.

See upstream bug at https://bugreports.qt.io/browse/QTBUG-14750

Related branches

Changed in unity-scope-click (Ubuntu):
status: New → Confirmed
Revision history for this message
Paweł Stołowski (stolowski) wrote :

It seems this is related to network caching. Removing all cache files from /home/phablet/.cache/unity-scope-click/network (wait till scope is restarted) fixes it (correct language is used).

Server side of the store was just recently updated with more relaxed expiration times, so now cache is actually used in more cases than before. The "Vary" header sent by the server seems to be correct (contains Accept-Language, among others), so I'm wondering if Qt handles Vary header correctly.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Ok, I think this might be problem with Qt, found an old bug and commented on it: https://bugreports.qt.io/browse/QTBUG-14750

Revision history for this message
James Henstridge (jamesh) wrote :

Looking inside the files under ~/.cache/unity-scope-click/network, the data files seem to contain the URL, HTTP response headers and body. I don't see anything resembling HTTP request headers, so it isn't clear how the Qt code could even implement Vary.

And in fact, this seems to be an open unresolved bug, filed in 2010:

https://bugreports.qt.io/browse/QTBUG-14750

Changed in unity-scope-click (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Yeah, I checked Qt code as per my comment to https://bugreports.qt.io/browse/QTBUG-14750

I think the only reasonable way we can work around this until Qt is fixed is to save current language in a text file and forcefully clear the cache on scope start if we see language has changed.

summary: - Language does not change back to English
+ Language in the Store scope doesn't always change
summary: - Language in the Store scope doesn't always change
+ Language in the Store scope doesn't always change when user switches
+ lang of the phone
Changed in canonical-devices-system-image:
assignee: nobody → Alejandro J. Cura (alecu)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Albert Astals Cid (aacid) wrote : Re: Language in the Store scope doesn't always change when user switches lang of the phone

Since you've identified the problem in Qt, would fixing the problem there be much harder than workarounding it on our side?

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Yes. According to James' finding, headers of HTTP requests are not currently stored in the cache. Fixing that may involve additions or changes to QAbstractNetworkCache interface. The workaround in scope will be a few lines of code. That being said, the bug needs to be fixed in Qt (I've emailed lpotter today) as it may manifest itself in other areas (Ubuntu serves use Vary header a lot with multiple values, not just language).

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Just to clairfy, I think we should implement that quick workaround in scope now and at the same time look for a proper fix in Qt.

Changed in canonical-devices-system-image:
milestone: none → 12
Changed in unity-scope-click (Ubuntu):
assignee: nobody → Pawel Stolowski (stolowski)
Changed in unity-scope-click (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Lorn Potter (lorn-potter) wrote :

I briefly looked into fixing QNetworkRequest/QNetworkAccessManager (I presume that is what you are using), it looks fairly easy three lines at most (famous last words) to fix.

Changed in qtbase-opensource-src (Ubuntu):
assignee: nobody → Lorn Potter (lorn-potter)
importance: Undecided → Medium
Revision history for this message
Lorn Potter (lorn-potter) wrote :

What are the steps to reproduce this?
I tried several times switching system language English->Spanish (reboot) and then back to English (reboot) and store scope did the correct thing.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Hi Lorn, added to the bug description.

description: updated
Changed in canonical-devices-system-image:
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in qtbase-opensource-src (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity-scope-click - 0.1.1+16.10.20160525-0ubuntu1

---------------
unity-scope-click (0.1.1+16.10.20160525-0ubuntu1) yakkety; urgency=medium

  * Add conditional debug for network timings. Force cached data if
    network is 'disconnected' (as per connectivity status reported by
    scopes API).
  * Build-depend on ubuntu-sdk-libs to avoid dependency problem on
    arm64.
  * Clear network cache if language was changed (LP: #1575744)
  * Use text widget to display error strings. (LP: #1542854)

 -- Pawel Stolowski <email address hidden> Wed, 25 May 2016 16:20:15 +0000

Changed in unity-scope-click (Ubuntu):
status: In Progress → Fix Released
summary: - Language in the Store scope doesn't always change when user switches
- lang of the phone
+ network disk cache does not take into account the HTTP Vary header
description: updated
Changed in canonical-devices-system-image:
assignee: Alejandro J. Cura (alecu) → John McAleely (john.mcaleely)
milestone: 12 → 13
Changed in qtbase-opensource-src (Ubuntu):
status: Confirmed → Fix Committed
status: Fix Committed → Confirmed
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

mark fixed with workaround but leave the real qt fix task open

Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Changed in qtbase-opensource-src (Ubuntu):
assignee: Lorn Potter (lorn-potter) → nobody
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.