-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the Bug
When I call up a non-existent page in Bookstack, e.g., https://demo.bookstackapp.com/trigger404notexistent123123, the CPU goes up to 100%.
Using MariaDB > show full processlist; i discovered the following query as the cause of the error:
select *,viewable_id, viewable_type, SUM(views) as view_count from viewswhere (exists (selectentity_id, entity_type, max(owner_id) as owner_id, max(status) as status from joint_permissionswhereviews.viewable_id=joint_permissions.entity_idandrole_idin (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) andviews.viewable_type=joint_permissions.entity_typegroup byentity_type, entity_id having (status IN (1, 3) or (owner_id = ? and status != 2)))) and (viewable_type!= ? or exists (selectpage_idfromentity_page_datawhereentity_page_data.page_id=views.viewable_idandviews.viewable_type= ? andentity_page_data.draft= ?)) andviewable_typein (?) group byviewable_id, viewable_typeorder byview_count desc limit 10 offset 0
We use a lot of roles and have a larger instance running (4000 pages in 216 books).
The joint_permissions table has 980,000 entries.
Maybe that's causing the error.
I am on the newest Version: BookStack v25.11.6 with a fresh installed Debian 13 Server (the problem existed also on Deb12 with an lower BookStack Version)
Steps to Reproduce
Go to https://demo.bookstackapp.com/trigger404notexistent123123
Expected Behaviour
that the CPU does not go to 100% and performance should be better
Screenshots or Additional Context
Browser Details
No response
Exact BookStack Version
v25.11.6