VL set to wildcard crashes Calibre

Bug #1927179 reported by ownedbycats
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Charles Haley

Bug Description

Calibre 5.17* (x64, run from source)

While setting up a new virtual library, I put "*" as a placeholder expression. This resulted in Calibre crashing and unable to launch again without dying. Thankfully I was able to fix it by editing the database directly.

Thank you and sorry for my stupidity :P

description: updated
description: updated
description: updated
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1927179

Doesnt crash for me with a VL with the expression *

Can you run in debug mode with

calibre-debug -g

and post the error, if any

 status incomplete

Changed in calibre:
status: New → Incomplete
Revision history for this message
ownedbycats (ownedbycats) wrote :

Running from source. After pressing "ok" from the screenshot dialog Calibre stalled, turned white, and then crashed after about 30 seconds. Unfortunately nothing appeared in the console during that time.

In the database, here's the virtual_libraries row from the preferences table:

{
  "Cleanup": "search:\"=Cleanup\"",
  "Documentation and Manuals": "#manualtype:true",
  "Fanfiction": "#fanficcat:true",
  "Loans": "formats:overdrive",
  "My Books": "(search:\"=Has eBook\") AND #manualtype:false AND #fanficcat:false",
  "Physical Books": "formats:paperbook",
  "Series": "series:true AND (not tags:\"=.Documentation and Manuals\" and not tags:\"=.Fanfiction\" and not tags:\"=.Magazines and Periodicals\" and not tags:@cleanup)",
  "Wildcard": "*"
}

Revision history for this message
ownedbycats (ownedbycats) wrote :

Also if it matters I have VLs showing as tabs.

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

I'm guessing it will have something to do with one of the template based
columns in your library. Attach the metadata.db file from your library
and I will see if I can repro with that.

 status incomplete

Revision history for this message
ownedbycats (ownedbycats) wrote :

My regular library is way too big, but a copy of it with a few books added resulted in the same crash (though quicker). This database was zipped up after the crash.

Revision history for this message
ownedbycats (ownedbycats) wrote :

Also, the virtual_libraries row will be slightly different as I cleaned up my Series VL expression a bit

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

Changing the component for this bug.

 assignee cbhaley
 status triaged

Revision history for this message
Kovid Goyal (kovid) wrote :
Download full text (11.1 KiB)

@charles: It's a stack overflow involving inifinite recursion with
virtual_libraries_for_books. Here's the trace:

Fatal Python error: _Py_CheckRecursiveCall: Cannot recover from stack overflow.
Python runtime state: initialized

Thread 0x00007fb6f37fe640 (most recent call first):
  File "/usr/lib/python3.9/threading.py", line 316 in wait
  File "/usr/lib/python3.9/threading.py", line 574 in wait
  File "/home/kovid/work/calibre/src/calibre/db/backup.py", line 47 in wait
  File "/home/kovid/work/calibre/src/calibre/db/backup.py", line 53 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007fb6f3fff640 (most recent call first):
  File "/usr/lib/python3.9/socket.py", line 831 in create_connection
  File "/usr/lib/python3.9/http/client.py", line 919 in connect
  File "/usr/lib/python3.9/http/client.py", line 1415 in connect
  File "/home/kovid/work/calibre/src/calibre/utils/https.py", line 195 in get_https_resource_securely
  File "/home/kovid/work/calibre/src/calibre/gui2/update.py", line 49 in get_newest_version
  File "/home/kovid/work/calibre/src/calibre/gui2/update.py", line 89 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007fb711079640 (most recent call first):
  File "/home/kovid/work/calibre/src/calibre/gui2/device.py", line 432 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007fb7118ba640 (most recent call first):
  File "/usr/lib/python3.9/threading.py", line 316 in wait
  File "/usr/lib/python3.9/queue.py", line 180 in get
  File "/home/kovid/work/calibre/src/calibre/utils/ipc/server.py", line 167 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Current thread 0x00007fb74e1e9740 (most recent call first):
  File "/home/kovid/work/calibre/src/calibre/db/search.py", line 506 in get_matches
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 453 in _get_matches
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 449 in evaluate_token
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 400 in evaluate
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 406 in evaluate_and
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 400 in evaluate
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 392 in _parse
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 448 in evaluate_token
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 400 in evaluate
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 413 in evaluate_or
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_parser.py", line 400 in evaluate
  File "/home/kovid/work/calibre/src/calibre/utils/search_query_par...

Changed in calibre:
assignee: nobody → Charles Haley (cbhaley)
status: Incomplete → Triaged
Revision history for this message
Charles Haley (cbhaley) wrote :

Note that the problem had nothing to do with wildcards. It was triggered by an unanchored search specification (one with no column), which caused all the composite columns to be evaluated.

Changed in calibre:
status: Triaged → Fix Committed
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: Fix Committed → Fix Released
Revision history for this message
ownedbycats (ownedbycats) wrote :

That expains my attempts to fix it. The first time just to be on the safe side I just changed the expression to "foo" but it crashed again. The second time I removed the line entirely and it loaded.

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.