Opening books using the book reader fails to load.

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

Bug Description

I have Calibre 5.31.1 64 bit installed under Winows 10.

I have book reader pinned to my task bar, and when I wanted to re-open a book to continue reading, I would normally have done this using the jump list from the task bar.

With the previous release, doing this started to cause difficulties, and with the current build it always fails to open a book this was. The book reader opens, but then it's a neverending loading next section.

If I open the book reader first from the task bar, and then select the book using the list presented within it's no problem at all.

This is more habit I guess because that's the way I've done it for years, but clearly something has also changed either by design or through a bug.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1950673

I no longer have a windows 10 test system, but on my windows 11 machine
opening books via the jump list of a pinned e-book viewer icon works
fine for me.

Opening via jump list just calls ebook-viewer.exe with the file path as
far as I know. Just like using open with in windows explorer. Does that
work for you?

 status invalid

Changed in calibre:
status: New → Invalid
Revision history for this message
Charles Haley (cbhaley) wrote :

It "mostly" works for me with Windows 10, calibre 5.32. My testing steps were:
1) Pin the viewer on the task bar.
2) Drag a book to the task bar icon to add it to the icon.
3) Right-click on the viewer icon and select the pinned book. The book opens.
4) Repeat #3 several times

The "mostly" is there because occasionally I would get "Loading next section of <book>, please wait". Once or twice I got an empty screen. These happened only if I closed the viewer immediately after progressing to the first page of a new file/chapter. When this happened, closing the window (this takes a couple of seconds) and re-opening it always took me to the correct display. It never happened if I opened the book from the viewer's last-book list.

I use the binary so I don't have any obvious debug log. Is there debugging information somewhere?

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1950673

You can get a debug log if you run it as

calibre-debug -w file

in the console.

It should be reproduceable that way as well, sinceits the same code path

Revision history for this message
Michael Kelly (sabiel) wrote :

Looks like my responses didn't come through here. I responded to the emails and since they didn't fail to send I thought it was fine.

Basically my response was that I've now upgraded to Windows 11 myself. I tied the method you suggested an it worked. It also worked from the jump list too. What I've subsequently though is that this is only some times. It appears to behave in three ways: the book opens very quickly, it opens but very slowly (over 10 seconds), it gets stuck on the loading next section.

Do you want me propduce a log as well? I installed via the installer.

Revision history for this message
Charles Haley (cbhaley) wrote :

c:\CBH_Data\calibre.git>calibre-debug -w "path-to-book"
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 86.46808510638297 x 86.41063122923588
Using calibre Qt style: True
[0.000] Load of book started
[0.000] prepared emitted
[0.015] webview loading requested
[0.218] bridge ready
[0.547] loading finished
***** This worked. I moved to the next chapter/file break then quit the viewer

c:\CBH_Data\calibre.git>calibre-debug -w "path-to-book"
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 86.46808510638297 x 86.41063122923588
Using calibre Qt style: True
[0.000] Load of book started
[0.016] prepared emitted
[0.032] webview loading requested
[0.235] bridge ready
[0.563] loading finished
INFO: userscript:viewer.js:23: Ignoring unencrypted message from iframe: {"action":"ready"}
***** I see an empty screen
***** I quit the viewer by closing the window
INFO: userscript:viewer.js:23: Could not process message from parent:
INFO: userscript:viewer.js:16715: TypeError: Cannot read property 'decrypt' of undefined

c:\CBH_Data\calibre.git>calibre-debug -w "path-to-book"
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 86.46808510638297 x 86.41063122923588
Using calibre Qt style: True
[0.000] Load of book started
[0.015] prepared emitted
[0.031] webview loading requested
[0.234] bridge ready
[0.547] loading finished
***** This worked

Revision history for this message
Charles Haley (cbhaley) wrote :

c:\CBH_Data\calibre.git>calibre-debug -w "path-to-book"
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 86.46808510638297 x 86.41063122923588
Using calibre Qt style: True
[0.000] Load of book started
[0.000] prepared emitted
[0.015] webview loading requested
[0.234] bridge ready
INFO: userscript:viewer.js:23: Ignoring unencrypted message from iframe: {"action":"ready"}
***** This time I got the "Loading next section of <book>, please wait" message. I waited 30 seconds.
***** I quit the viewer by closing the window with the 'X'
INFO: userscript:viewer.js:23: Could not process message from parent:
INFO: userscript:viewer.js:16715: TypeError: Cannot read property 'decrypt' of undefined

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

If by running calibre-debug -w somefile
you can get it to freeze at loading...
then attaching the log and possibly the book that caused the freeze
would be helpful.

Revision history for this message
Charles Haley (cbhaley) wrote :

FWIW: it also happens when running from latest source "master".

Revision history for this message
Charles Haley (cbhaley) wrote :

When running from source:
c:\CBH_Data\calibre.git>calibre-debug -w "path-to-book"
Turning on automatic hidpi scaling
devicePixelRatio: 1.0
logicalDpi: 96.0 x 96.0
physicalDpi: 86.46808510638297 x 86.41063122923588
Using calibre Qt style: True
Compiling viewer code...
[0.000] Load of book started
[0.000] prepared emitted
[0.031] webview loading requested
[0.203] bridge ready
INFO: userscript:viewer.js:24: Ignoring unencrypted message from iframe: {"action":"ready"}
INFO: userscript:viewer.js:24: Could not process message from parent:
INFO: userscript:viewer.js:16763: TypeError: Cannot read property 'decrypt' of undefined

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

OK, let me see if I can reproduce, that error in the log about
unencrypted messages *should* be impossible, bu I suspect there is
a race involved.

Revision history for this message
Charles Haley (cbhaley) wrote :

It happens when I run from source so let me know if there are any experiments you want me to try.

Revision history for this message
Michael Kelly (sabiel) wrote :

You would have to treat me as knowing nothing in order to obtain a log I'm afraid.

It does occur with every book I've tried to open for quite a while now. It's not limited to one, or a few books.

As I said in my initial post, I'm running Calibre 5.31.1 64 bit, and the problem started with the release before that. Prior to that I'd never encountered an issue like this in years. Something that changed between those releases would appear to the cause then.

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

@Charles: Doesnt reproduce at all for me with the following steps:

1) calibre-debug -w file.epub
2) Ctrl+page down to ump to next chapter
3) Alt+f4 to close book immediately
4) calibre-debug -w file.epub

Repeat a few times, no hangs. The relevant code involved is
in iframe_comm.pyj

This controls communication between the viewer's UI and the iframe in
which the book content is loaded.

The control flow is:

1) IFrameClient gets the load event when it's loaded and sends the UI a
"ready" message. This happens around line 189 of iframe_comm.pyj

2) The UI receives the ready message in on_iframe_ready at line 153 and
sends the iframe a message to inititalize encrypted communication.

The error you receive about an unencrypted ready message basically means
the iframe sent the UI two ready messages, one to trigger encryption and
another immediately afterward. But this should be impossible.

Can you add some console.log(event.data) lines in the two
handle_message() methods to get a log of the communication?

Also I made a couple of commits to improve logging, so add the
console.log lines after pulling from master.

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

Never mind, I figured out the issue. I will fix it tomorrow.

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
Kovid Goyal (kovid) wrote : Re: calibre bug 1950673

@Charles: I have committed a fix, please let me know if it works for
you.

Revision history for this message
Charles Haley (cbhaley) wrote :

It worked for 10 attempts. I think you swatted it.

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

Excellent, thanks for the help!

Revision history for this message
Frank Mouson (fmouson) wrote (last edit ):

I've also faced similar difficulties while opening my books using the jump list from the taskbar. It used to work fine in the past, but with the latest build, I always end up with a never-ending loading next section. However, like you, I've found a workaround by opening the book reader from the taskbar and selecting the book from within. I remember struggling to complete a writing task because of technical difficulties with my computer. Luckily, I found professional help at https://edubirdie.com/top-writers which helped me meet my deadline without compromising on the quality of my work. These minor software changes can often cause us a lot of inconveniences, especially when we're trying to meet deadlines. Therefore, I try to use reliable programs more so as not to get into trouble.

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.