Bookstack failed to handle image and/or create thumbnails due to system resource limits
Attempted Debugging
- [X] I have read the debugging page
Searched GitHub Issues
- [X] I have searched GitHub for the issue.
Describe the Scenario
Hi! We have a problem with our Bookstack site. When we try to insert a new image, the image selection box fails to show any thumbnail and We're unable to upload new images to the platform.
This is running serverless on GCP Cloud Run.
Most of the reported issues refer to php limit but how can we be sure, we don't have CLI to check or modify php.ini, if that could be the problem?
Exact BookStack Version
v23.12.2-ls125
Log Content
The log shows this:
2024-05-31 21:52:49.636 CEST
POST500830 B795 msChrome 125 http://wiki.ingenia.la/images/gallery?uploaded_to=144
On the GCP console the error is as follows:
{
httpRequest: {
latency: "0.795066948s"
protocol: "HTTP/1.1"
referer: "https://wiki.ingenia.la/books/procedimientos-ingenials/page/nuestros-gastos/edit"
remoteIp: "172.68.216.130"
requestMethod: "POST"
requestSize: "291133"
requestUrl: "http://wiki.ingenia.la/images/gallery?uploaded_to=144"
responseSize: "830"
serverIp: "34.128.145.114"
status: 500
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
}
insertId: "665a2a920006a17dc6de4352"
labels: {
instanceId: "00f46b9285c2c05ea2ebf7a494d3d065b161ddd46949d05f85e031a01f08bb3626f90e6548ff51ec46a3d8f3a55f6af7bc27c4bd569c051956b50a0d49ab5c9910"
}
logName: "projects/influence-413820/logs/run.googleapis.com%2Frequests"
receiveTimestamp: "2024-05-31T19:52:50.731041553Z"
resource: {
labels: {5}
type: "cloud_run_revision"
}
severity: "ERROR"
spanId: "1293029083332901613"
timestamp: "2024-05-31T19:52:49.636972Z"
trace: "projects/influence-413820/traces/43e175bd5c308361031888151d5719ab"
traceSampled: true
}
On the browser console:
app.js?version=v23.12.2:43 Refused to set the document's base URI to '' because it violates the following Content Security Policy directive: "base-uri 'self'".
init_instance_callback @ app.js?version=v23.12.2:43
(anonymous) @ tinymce.min.js?version=v23.12.2:4
pO @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
Promise.then (async)
(anonymous) @ tinymce.min.js?version=v23.12.2:4
fold @ tinymce.min.js?version=v23.12.2:4
hO @ tinymce.min.js?version=v23.12.2:4
n @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
load (async)
(anonymous) @ tinymce.min.js?version=v23.12.2:4
_o @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
xO @ tinymce.min.js?version=v23.12.2:4
await in xO (async)
o @ tinymce.min.js?version=v23.12.2:4
Promise.then (async)
_O @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
render @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
(anonymous) @ tinymce.min.js?version=v23.12.2:4
Re @ tinymce.min.js?version=v23.12.2:4
s @ tinymce.min.js?version=v23.12.2:4
executeHandlers @ tinymce.min.js?version=v23.12.2:4
i @ tinymce.min.js?version=v23.12.2:4
s @ tinymce.min.js?version=v23.12.2:4
app.js?version=v23.12.2:19
POST https://wiki.ingenia.la/images/gallery?uploaded_to=144 500 (Internal Server Error)
startXhrForUpload @ app.js?version=v23.12.2:19
createUploadFromFile @ app.js?version=v23.12.2:19
(anonymous) @ app.js?version=v23.12.2:19
app.js?version=v23.12.2:19
POST https://wiki.ingenia.la/images/gallery?uploaded_to=144 500 (Internal Server Error)
startXhrForUpload @ app.js?version=v23.12.2:19
createUploadFromFile @ app.js?version=v23.12.2:19
(anonymous) @ app.js?version=v23.12.2:19
app.js?version=v23.12.2:19
POST https://wiki.ingenia.la/images/gallery?uploaded_to=144 500 (Internal Server Error)
startXhrForUpload @ app.js?version=v23.12.2:19
createUploadFromFile @ app.js?version=v23.12.2:19
(anonymous) @ app.js?version=v23.12.2:19
Hosting Environment
GCP Cloud Run.
Hi, I realized a difference between your logfile and the console output. In your logfile it says http://wiki.foo.bar, but the error shows https://wiki.foo.bar. Is your base uri correctly defined in your env file?
Hi...Possibly related to this thread? https://github.com/BookStackApp/BookStack/issues/5029#issue-2312227088
Yeah, that reflected error message will generally show when you're hitting the memory limit during image resizing.
You can try to bump the PHP memory_limit in your environment, which addresses this in most cases.
Yeah, that reflected error message will generally show when you're hitting the memory limit during image resizing. You can try to bump the PHP
memory_limitin your environment, which addresses this in most cases.
Thanks! I think you're right, that may be the problem. I will rebuild the image and try again. Later I'll post the result.
Any recommendation regarding memory_limit, any recommended value?
Thanks!
@rodgaray The PHP default is 128M, so doubling to 256M alleviates most scenarios.
@rodgaray The PHP default is
128M, so doubling to256Malleviates most scenarios.
Hi, thank you for your reply. I have a problem, the installation is serverless, so I need to rebuild the docker image with the PHP.ini within it. I was able to make a build from the GitHub code but I don't know where the php.ini should be.
@rodgaray What docker image were you originally using, and do you still have access (or able to use) docker volume mounts?
@rodgaray Going by the original post, I'm assuming the linuxserver contianer.
They provide a way to customize php.ini values by default, via the php/php-local.ini file within the folder/files you have mounted to the /config path on the container.
Had the same issue just now, trying to upload a 3.7MB Image (Long scrolling image of a page we need for reference) We are not running in docker. Had PHP Memory limit set to 256MB changed to 512MB and the upload worked. Pretty weird but, it works now!
Environment: PHP 8.3 NGINX Ubuntu 22.04
I had the same just now, when uplaoding PNG-images 17-21MB. Using the Linuxserver docker image
I am having the same issue even with 500kb images. Pretty sure was working fine till some days ago...might be new linuxserver release?
Edit: fixed following https://github.com/BookStackApp/BookStack/issues/5029#issuecomment-2127906502
I can add, for me upload is working, and adding the pictures is working, it is just the thumbnail when adding that is not working.
"Failed to create gallery thumbnails due to system resource limits."