file attachment upload throws error "object object" #2687

Closed
opened 2026-02-05 04:47:57 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @towerplease on GitHub (Mar 2, 2022).

Describe the Bug

Uploading a file with ~400 MB fails with following error:
image

smaller files upload without any issue.

Steps to Reproduce

Create or edit page
upload larger file (ex. 400 MB)
upload completes but fails with error "object object"

Expected Behaviour

File should be uploaded normally

Screenshots or Additional Context

image

Browser Details

Opera / Chrome

Exact BookStack Version

v22.02.1

PHP Version

7.4.3

Hosting Environment

Ubuntu 20.04 VPS - 4 Core / 4 GB RAM

Originally created by @towerplease on GitHub (Mar 2, 2022). ### Describe the Bug Uploading a file with ~400 MB fails with following error: ![image](https://user-images.githubusercontent.com/21177236/156329312-d1f85fdf-27bd-46cc-8752-ead5bf9b2774.png) smaller files upload without any issue. ### Steps to Reproduce Create or edit page upload larger file (ex. 400 MB) upload completes but fails with error "object object" ### Expected Behaviour File should be uploaded normally ### Screenshots or Additional Context ![image](https://user-images.githubusercontent.com/21177236/156329518-b506c848-b336-426b-8df0-8149ca691067.png) ### Browser Details Opera / Chrome ### Exact BookStack Version v22.02.1 ### PHP Version 7.4.3 ### Hosting Environment Ubuntu 20.04 VPS - 4 Core / 4 GB RAM
OVERLORD added the 🐛 Bug label 2026-02-05 04:47:57 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Mar 2, 2022):

Hi @towerplease,
Thanks for reporting. I suspect this is due to hitting PHP memory limits.
Can you try uploading again and check the BookStack logs for error messages performing this upload:

# Watch log file, Ran fro BookStack install directory
tail -f storage/logs/laravel.log

Then let us know any error messages that occur.

@ssddanbrown commented on GitHub (Mar 2, 2022): Hi @towerplease, Thanks for reporting. I suspect this is due to hitting PHP memory limits. Can you try uploading again and check the BookStack logs for error messages performing this upload: ```bash # Watch log file, Ran fro BookStack install directory tail -f storage/logs/laravel.log ``` Then let us know any error messages that occur.
Author
Owner

@towerplease commented on GitHub (Mar 2, 2022):

Hey @ssddanbrown looks like you are right, here the output:
image

In Text:
#0 {main} "} [2022-03-02 11:22:05] production.ERROR: Allowed memory size of 268435456 bytes exhausted (tried to allocate 170213376 bytes) {"userId":3,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 268435456 bytes exhausted (tried to allocate 170213376 bytes) at /var/www/bookstack/vendor/symfony/http-foundation/Response.php:381) [stacktrace] #0 {main} "} [2022-03-02 11:23:20] production.ERROR: Allowed memory size of 268435456 bytes exhausted (tried to allocate 274113272 bytes) {"userId":3,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 268435456 bytes exhausted (tried to allocate 274113272 bytes) at /var/www/bookstack/app/Uploads/AttachmentService.php:214) [stacktrace] #0 {main} "}
What Memorysize do you suggest, currently its 256 MB via php.ini.

Thank you!

@towerplease commented on GitHub (Mar 2, 2022): Hey @ssddanbrown looks like you are right, here the output: ![image](https://user-images.githubusercontent.com/21177236/156352831-79e2f123-86f6-4744-9333-861fd9d80db2.png) In Text: `#0 {main} "} [2022-03-02 11:22:05] production.ERROR: Allowed memory size of 268435456 bytes exhausted (tried to allocate 170213376 bytes) {"userId":3,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 268435456 bytes exhausted (tried to allocate 170213376 bytes) at /var/www/bookstack/vendor/symfony/http-foundation/Response.php:381) [stacktrace] #0 {main} "} [2022-03-02 11:23:20] production.ERROR: Allowed memory size of 268435456 bytes exhausted (tried to allocate 274113272 bytes) {"userId":3,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 268435456 bytes exhausted (tried to allocate 274113272 bytes) at /var/www/bookstack/app/Uploads/AttachmentService.php:214) [stacktrace] #0 {main} "} ` What Memorysize do you suggest, currently its 256 MB via php.ini. Thank you!
Author
Owner

@ssddanbrown commented on GitHub (Mar 2, 2022):

What Memorysize do you suggest, currently its 256 MB via php.ini.

Probably at least the file size size you want to upload plus some buffer. Potentially a multiple of that right now.
Large files handling is a little unoptimized right now (Open in #2886) and data is not always streamed where possible.

It's likely that memory limits are also causing the problems on your other issue raised.

@ssddanbrown commented on GitHub (Mar 2, 2022): > What Memorysize do you suggest, currently its 256 MB via php.ini. Probably at least the file size size you want to upload plus some buffer. Potentially a multiple of that right now. Large files handling is a little unoptimized right now (Open in #2886) and data is not always streamed where possible. It's likely that memory limits are also causing the problems on your other issue raised.
Author
Owner

@towerplease commented on GitHub (Mar 2, 2022):

Okay, so i set it to 512MB now, thats around 100 MB more than the largest File i currently have. I think thats a fix for the issue, but actually the memory limit should not be associated with the upload size, maybe there is some optimization potential for future releases. :)

Thank you very much!

@towerplease commented on GitHub (Mar 2, 2022): Okay, so i set it to 512MB now, thats around 100 MB more than the largest File i currently have. I think thats a fix for the issue, but actually the memory limit should not be associated with the upload size, maybe there is some optimization potential for future releases. :) Thank you very much!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2687