Viewer crash on macOS when advancing to next chapter

Bug #1881375 reported by aphemos on 2020-05-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Hello,

Recently, I have been experiencing crashing with certain EPUBs. It usually happens as I am paging through a file, and at the end, upon advancing to the next chapter, a crash. It seems that with certain files, it happens consistently. Perhaps a sample EPUB later would help. Logs attached.

aphemos (aphemos) wrote :

Attach an EPUB file demonstrating/reproducing the problem to this bug report. You can do that by clicking the "Add attachment or patch" link at the bottom of the bug's page. If the file you are attaching is copyrighted, mark the bug as private. You can do this by clicking the tiny yellow icon next to "This report contains Public information" in the top right area of the bug's page.

 status incomplete

Changed in calibre:
status: New → Incomplete
aphemos (aphemos) wrote :

Trying again on the most recent crash, I wasn't able to reproduce it. Though as you can see from the logs, before I had 3 or more crashes per day, then I would skip certain EPUBs to try to avoid it, unsure if it was those EPUBs. As a crash on macOS requires a reboot to get the viewer working again, it'd be nice to track down somehow.

Trying to find the old EPUB that might have caused it, I was unable. Is there any other way to debug this? Of what might cause it, I use flow mode. I also have a tendency when opening new EPUBs, to quickly in succession press the next page key to skip front matter to get to the intro chapter or so. From what I can remember, it tended to happen when I was quickly paging through chapters.

Kovid Goyal (kovid) wrote :

It's a crash inside webengine, not in calibre code. Without a reproducer
tracking it is going to be impossible. If you are able to figure out how
to reproduce it, do update this bug report and I will take a look.

  status invalid

Changed in calibre:
status: Incomplete → Invalid
aphemos (aphemos) wrote :

The crash wouldn't be so bad if I didn't need single viewer instance and thus need a reboot with each crash. I saw a note about allowing address reuse. Perhaps that could avoid the address already in use issue?

Kovid Goyal (kovid) wrote :

Sorry not something I am interested in, but patches are welcome.

Kovid Goyal (kovid) wrote :

oh and you dont need to reboot, just delete the socket file referenced
in the error message manually

aphemos (aphemos) wrote :

If such were possible, that'd be helpful. No file referenced. Error is:

ERROR: Failed to start viewer: [Errno 48] Address already in use

Traceback (most recent call last):
  File "site-packages/calibre/gui2/viewer/main.py", line 202, in main
  File "site-packages/calibre/gui2/viewer/main.py", line 144, in ensure_single_instance
  File "site-packages/calibre/gui2/viewer/main.py", line 118, in create_listener
  File "lib/python2.7/multiprocessing/connection.py", line 132, in __init__
  File "lib/python2.7/multiprocessing/connection.py", line 256, in __init__
  File "lib/python2.7/socket.py", line 228, in meth
error: [Errno 48] Address already in use

I found a /Library/Caches/calibre-singleinstance-501-calibre_viewer.lock though that doesn't help.

Kovid Goyal (kovid) wrote :

switch to the python 3 version of calibre, that should give you the path
https://www.mobileread.com/forums/showthread.php?t=325721

Once you have the path, you can go back to using regular calibre, the
path will be the same.

Kovid Goyal (kovid) wrote :

And looking at the code, it will be something like

/tmp/username-calibre-viewer.socket

aphemos (aphemos) wrote :

Thank you.

No luck with the python 3 version; error text is mostly the same:

calibre, version 4.99.5
ERROR: Failed to start viewer: [Errno 48] Address already in use

Traceback (most recent call last):
  File "main.py", line 201, in main
  File "main.py", line 143, in ensure_single_instance
  File "main.py", line 117, in create_listener
  File "connection.py", line 448, in __init__
  File "connection.py", line 591, in __init__
OSError: [Errno 48] Address already in use

/tmp/ was one of the first places I looked yet no files as such or anything that suggests calibre.

aphemos (aphemos) wrote :

found it. $TMPDIR which in my case was /var/folders/10/6s777qrn0y1fqf3ysnc3qxt80000gn/T/

Kovid Goyal (kovid) wrote :

I dont see how that's possible, look at socket_address() in
ipc/__init__.py

aphemos (aphemos) wrote :

perhaps gettempdir() uses $TMPDIR

aphemos (aphemos) wrote :

I assume the viewer can detect when it's loading a new EPUB or starting for the first time. Is there any harm in checking for the file and deleting it if necessary?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments