content server - viewer does not show updated book/format

Bug #2004197 reported by obix
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

Calibre version: 6.11
OS: Ubuntu 22.04.1 LTS
Browser: Firefox 109.0, Google Chrome 109.0.5414.74

After updating a book/format the viewer of the content server does not show the updated version of the book/format but the old version.

Steps to reproduce:

1) create test.txt on filesystem with content "1"
2) upload test.txt to content server
3) open book in content server for reading
4) shows: "1"
5) change content of test.txt on filesystem to "2"
6) on content server: edit metadata, click "formats", upload "test.txt" from filesystem
        a) reload book in viewer on content server => still shows "1"
        b) reopen book in viewer => still shows "1"
        c) reopen book after deleting "downloaded books" on content server => still shows "1"
        d) downloading book from content server and open with system editor => shows "2" (in all cases a-c)

Alternative 1:
6) use calibredb "add_format" to upload new version of test.txt (content: "2")
=> 6a)-d) as before

Alternative 2:
6) use calibredb remove_format "TXT" followed by add_format to upload new version of test.txt (content: "2")
=> 6a)-d) as before

Alternative 3:
6) edit metadata => delete format TXT, upload "test.txt" from filesystem
=> 6a)-d) as before

same with e.g. odt format.

Revision history for this message
Kovid Goyal (kovid) wrote :

Use the reload button in the viewer controls. The viewer operates of a
locally stored copy and does not change that unless asked to by the
user.

Changed in calibre:
status: New → Invalid
Revision history for this message
obix (e-chomas-g) wrote :

See step 6a)
pressing reload button in viewer (and confirm reload in following dialog) has no effect.

Revision history for this message
Kovid Goyal (kovid) wrote :

Does not replicate for me. Try doing a hard refresh in your browser
before hitting reload.

Revision history for this message
obix (e-chomas-g) wrote :

Thanks for your input!

Tested again. Got it to work, but only this way:

1) Press "reload" in editor and confirm reload => old version is displayed
2) Do hard refresh (Firefox: Strg+Shift+R) => new version is displayed

Doing a hard refresh before hitting reload button (step 1) had no effect.

Any idea to circumvent the manual hard reset?

Revision history for this message
Kovid Goyal (kovid) wrote :

hard to say depends on why the browser is caching things for you. The
ajax queries to get the book data all add a unique query parameter to
ensure that they are not cacheable. Have you got some kind of aggressive
caching policy or proxy in your setup?

Revision history for this message
obix (e-chomas-g) wrote :

No proxy and no special caching policy (as far as I know).

Retried with a fresh setup of calibre on my local machine (server localhost) with 3 different browsers - same behaviour.

I now used wirshark to look at the communication with my server. After pressing reload button in viewer there is a GET-Request to the server with a query parameter different from the "original" viewer query and one gets e.g. the following response (in this example containing the just updated content "15"):

Transmission Control Protocol, Src Port: 8080, Dst Port: 37654, Seq: 1, Ack: 711, Len: 465
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
    Accept-Ranges: bytes\r\n
    Content-Length: 227\r\n
    Content-Type: text/html; charset=UTF-8\r\n
    Date: Tue, 31 Jan 2023 16:10:56 GMT\r\n
    ETag: "f8efb6c2c4432fecec64a22d311834d760a18a41"\r\n
    Keep-Alive: timeout=120\r\n
    Server: calibre 6.11.0\r\n
    \r\n
    [HTTP response 1/2]
    [Time since request: 0.016127509 seconds]
    [Request in frame: 37]
    [Next response in frame: 2701]
    [Request URI: http://calibre:8080/book-file/1127/TXT/2/16751778230/index.html?library_id=Calibre-Bibliothek&1675181456173]
    File Data: 227 bytes
Line-based text data: text/html (1 lines)
    {"version":1,"tree":{"n":"html","c":[{"n":"head","x":"\n ","l":"\n ","c":[{"n":"title","x":"Unbekannt","l":"\n \n "}]},{"n":"body","x":"\n","c":[{"n":"p","x":"15","l":"\n"}]}]},"ns_map":["http://www.w3.org/1999/xhtml"]}

But the update content ("15") is displayed in the viewer not before a hard reload.

Having no idea of ajax but just wondering, if there might be a problem with the viewer component not recognizing to show updated data (version numbering)?

Sorry for the blind guess but I have no idea what could cause unwanted caching on the client/browser side, especially when using 3 different browsers talking to localhost or the local server.

Still hoping you (or someone else) might have an idea what's causing this behaviour.

Thanks for your support and this great software!

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
Revision history for this message
obix (e-chomas-g) wrote :

Succesfully tested in a calibre development environment. In the viewer after pressing reload the updated content is shown.

Thank you very much for the quick fix!

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.