Saving a moderately big page performance problem #4837

Open
opened 2026-02-05 09:19:44 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @CamaroSS on GitHub (Jun 25, 2024).

Describe the Bug

Creating a moderately big page can hog up all of the server's CPU resources.
The document saving process itself hangs somewhere in /BookStack/app/Util/HtmlDocument.php
As the page is hung up saving, there are background PUT requests that make it worse because they hang as well.

The issue might be mitigated by not allowing more than one draft saving request on page at a time. Stopping draft saving requests after clicking "Save page" might help as well.

Steps to Reproduce

  1. Create a new page
  2. Go to source code editor
  3. Copy the attached file contents there. It's ~4Mb worth of HTML with lots of tables which is a database structure
    scheme1 - Copy.zip
  4. Try to save the page

Expected Behaviour

The page is saved after a while

Screenshots or Additional Context

Instead I get
PHP Fatal error: Maximum execution time of 1200 seconds exceeded in {path}\BookStack\app\Util\HtmlDocument.php on line 62
for the main saving process and the background draft saving processes. The CPU gets loaded up to 100%.

Browser Details

Firefox 127 on Windows 11

Exact BookStack Version

v24.05.1

Originally created by @CamaroSS on GitHub (Jun 25, 2024). ### Describe the Bug Creating a moderately big page can hog up all of the server's CPU resources. The document saving process itself hangs somewhere in `/BookStack/app/Util/HtmlDocument.php` As the page is hung up saving, there are background PUT requests that make it worse because they hang as well. The issue might be mitigated by not allowing more than one draft saving request on page at a time. Stopping draft saving requests after clicking "Save page" might help as well. ### Steps to Reproduce 1. Create a new page 2. Go to source code editor 3. Copy the attached file contents there. It's ~4Mb worth of HTML with lots of tables which is a database structure [scheme1 - Copy.zip](https://github.com/user-attachments/files/15967120/scheme1.-.Copy.zip) 4. Try to save the page ### Expected Behaviour The page is saved after a while ### Screenshots or Additional Context Instead I get **PHP Fatal error: Maximum execution time of 1200 seconds exceeded in {path}\BookStack\app\Util\HtmlDocument.php on line 62** for the main saving process and the background draft saving processes. The CPU gets loaded up to 100%. ### Browser Details Firefox 127 on Windows 11 ### Exact BookStack Version v24.05.1
OVERLORD added the 🐛 Bug🔍 Pending Validation labels 2026-02-05 09:19:44 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jun 25, 2024):

4MB is really quite large. There's over 68k table cells in that document. At some point content will come across limits, and that may very depending on specific content and system resources.
We can look into where bottlenecks may be for this kind of content, and look to improve that where possible/reasonable, but ultimately this is a large amount of content that may be better suited to be split up.

@ssddanbrown commented on GitHub (Jun 25, 2024): 4MB is really quite large. There's over 68k table cells in that document. At some point content will come across limits, and that may very depending on specific content and system resources. We can look into where bottlenecks may be for this kind of content, and look to improve that where possible/reasonable, but ultimately this is a large amount of content that may be better suited to be split up.
Author
Owner

@CamaroSS commented on GitHub (Jun 26, 2024):

I understand. But please mind that if one saving process is busy, it's better not to launch new ones. What I saw was one working POST and multiple PUT requests in Network tab.

@CamaroSS commented on GitHub (Jun 26, 2024): I understand. But please mind that if one saving process is busy, it's better not to launch new ones. What I saw was one working POST and multiple PUT requests in Network tab.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4837