Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error and HTTP/500 when loading a specific page or book #4929

Open
Guezone opened this issue Apr 4, 2024 · 4 comments
Open

SQL error and HTTP/500 when loading a specific page or book #4929

Guezone opened this issue Apr 4, 2024 · 4 comments
Labels

Comments

@Guezone
Copy link

Guezone commented Apr 4, 2024

Describe the Bug

Hello,

First of all, thank you very much for your work on this superb tool, Bookstack.

After a fresh installation of Bookstack (via Docker-compose, Linux-server image + mariadb, as per the docs), I imported via API about 13000 pages, spread over 3 books (which are also 3 different "Category" tags), with pause times to avoid reaching the rate limit of course.

When I try to click via the web UI on the largest "Unsorted" book (http://mydom.com/books/unsorted, 8200 pages approx.), I get a 500 error. I also get this 500 error when I click on a page in this book (http://mydom.com/books/unsorted/page/my-example-page).

Steps to Reproduce

(Check bug description)

Expected Behaviour

An error 500 appears on the browser.

Screenshots or Additional Context

Here are the logs found in laravel.log on the same time of the click :

[previous exception] [object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:414)
[stacktrace]
#0 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): PDO->prepare()
#1 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()
#2 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(720): Illuminate\\Database\\Connection->runQueryCallback()
#3 /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(405): Illuminate\\Database\\Connection->run()
#4 /app/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2705): Illuminate\\Database\\Connection->select()
#5 /app/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2694): Illuminate\\Database\\Query\\Builder->runSelect()
#6 /app/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3230): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#7 /app/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2693): Illuminate\\Database\\Query\\Builder->onceWithColumns()
#8 /app/www/app/Settings/SettingService.php(117): Illuminate\\Database\\Query\\Builder->get()
#9 /app/www/app/Settings/SettingService.php(73): BookStack\\Settings\\SettingService->loadToLocalCache()
#10 /app/www/app/Settings/SettingService.php(27): BookStack\\Settings\\SettingService->getValueFromStore()
#11 /app/www/app/App/helpers.php(81): BookStack\\Settings\\SettingService->get()
#12 /app/www/storage/framework/views/872733693c1f8e7d46945825e715cc42e8efb276.php(6): setting()
#13 /app/www/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')
#14 /app/www/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()
#15 /app/www/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()
#16 /app/www/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()
#17 /app/www/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()
#18 /app/www/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()
#19 /app/www/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()
#20 /app/www/storage/framework/views/6212e6f16538942c654408b0bb64b92abc2fa8d6.php(16): Illuminate\\View\\View->render()
#21 /app/www/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(109): require('...')
#22 /app/www/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(110): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()
#23 /app/www/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()
#24 /app/www/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(70): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()
#25 /app/www/vendor/laravel/framework/src/Illuminate/View/View.php(195): Illuminate\\View\\Engines\\CompilerEngine->get()
#26 /app/www/vendor/laravel/framework/src/Illuminate/View/View.php(178): Illuminate\\View\\View->getContents()
#27 /app/www/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\\View\\View->renderContents()
#28 /app/www/vendor/laravel/framework/src/Illuminate/Http/Response.php(69): Illuminate\\View\\View->render()
#29 /app/www/vendor/laravel/framework/src/Illuminate/Http/Response.php(35): Illuminate\\Http\\Response->setContent()
#30 /app/www/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(57): Illuminate\\Http\\Response->__construct()
#31 /app/www/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(87): Illuminate\\Routing\\ResponseFactory->make()
#32 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(626): Illuminate\\Routing\\ResponseFactory->view()
#33 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(554): Illuminate\\Foundation\\Exceptions\\Handler->renderHttpException()
#34 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(460): Illuminate\\Foundation\\Exceptions\\Handler->prepareResponse()
#35 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(377): Illuminate\\Foundation\\Exceptions\\Handler->renderExceptionResponse()
#36 /app/www/app/Exceptions/Handler.php(89): Illuminate\\Foundation\\Exceptions\\Handler->render()
#37 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(233): BookStack\\Exceptions\\Handler->render()
#38 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(210): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse()
#39 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(246): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException()
#40 /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleShutdown()
#41 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#42 {main}
"} 

Browser Details

Brave

Exact BookStack Version

v24.02.2

@Guezone Guezone changed the title SQL error when loading page or book SQL error and HTTP/500 when loading a specific page or book Apr 4, 2024
@ssddanbrown
Copy link
Member

8200 pages is very large in the context of a BookStack book. Might be getting into timeout/scale issues.

The error shared is a partial error message.
Please can you check the log again and fetch the error logged from the point it starts with a timestamp?

Should start something like [2024-04-01 16:54:36] production.ERROR

@Guezone
Copy link
Author

Guezone commented Apr 4, 2024

I've restarted bookstack in debug mode and this is the log I get. How can I get around this? I use the image lscr.io/linuxserver/bookstack for information.

[2024-04-05 00:02:12] production.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 610304 bytes) {"userId":1,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 134217728 bytes exhausted (tried to allocate 610304 bytes) at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:419)
[stacktrace]
#0 {main}
"} 

@Guezone
Copy link
Author

Guezone commented Apr 4, 2024

I changed the memory_limit in the php.ini configuration, based on other Github issues. It takes a little time to load, but I get no more errors! I'll think about the organization of documents in Bookstack for the future. What are the limits of each type of object (chapters, books, pages, etc.)?

I store and archive many articles retrieved from many RSS feeds, which I classify into 3 categories. I have pages for each article, a chapter for each month/year and a book for each category. What can you recommend? In any case, I'm going to try new ways of organizing my site to avoid this kind of problem.

@ssddanbrown
Copy link
Member

What are the limits of each type of object (chapters, books, pages, etc.)?

There's no hard limits in BookStack. It all comes down to hardware and UI limits, and usability can really come down to your use-case, so I'd advise testing against your use-case to see if it works for that, and scale-down/segment content (or potentially find an alternate platform) if things don't work well for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants