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

Google Drive node crashes container trying to upload mid-size file #12366

Open
Bounz opened this issue Dec 24, 2024 · 3 comments
Open

Google Drive node crashes container trying to upload mid-size file #12366

Bounz opened this issue Dec 24, 2024 · 3 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@Bounz
Copy link

Bounz commented Dec 24, 2024

Bug Description

The n8n container crashes with an out-of-memory error when attempting to upload moderately sized files to cloud storage services. This occurs even with files well within the container's memory limit.

Same issue occurs with Dropbox node

To Reproduce

  1. Set up n8n in a Docker container with 1.5GB memory limit
  2. Create a workflow that reads a local file (14.4MB in size)
  3. Add a Google Drive node to upload the file
  4. Execute the workflow

Result:

  • Entire workflow fails
  • Container crashes with out-of-memory error

Same issue occurs with Dropbox node

Expected behavior

The workflow should successfully upload the 14.4MB file without crashing the container, as the file size is significantly smaller than the container's memory limit (1.5GB).

Operating System

Ubuntu 22.04.3

n8n Version

1.72.1

Node.js Version

20.18.0

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Dec 24, 2024

Hey @Bounz,

We have created an internal ticket to look into this which we will be tracking as "N8N-8007"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Dec 24, 2024
@Bounz
Copy link
Author

Bounz commented Dec 24, 2024

Found this in logs:

Dec 25 01:10:55 PayloadTooLargeError: request entity too large <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at readStream (/app/code/node_modules/raw-body/index.js:156:17) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at executor (/app/code/node_modules/raw-body/index.js:113:5) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at new Promise (<anonymous>) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at getRawBody (/app/code/node_modules/raw-body/index.js:112:10) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at IncomingMessage.req.readRawBody (/app/code/node_modules/n8n/src/middlewares/body-parser.ts:40:34) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at parseBody (/app/code/node_modules/n8n/src/middlewares/body-parser.ts:52:12) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at bodyParser (/app/code/node_modules/n8n/src/middlewares/body-parser.ts:76:17) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at newFn (/app/code/node_modules/express-async-errors/index.js:16:20) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at Layer.handle [as handle_request] (/app/code/node_modules/express/lib/router/layer.js:95:5) <30>1 2024-12-24T20:10:55Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - at trim_prefix (/app/code/node_modules/express/lib/router/index.js:328:13)
Dec 25 01:11:56 10: 0x10d7f46 v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [node]
Dec 25 01:11:56 11: 0x10d7ffe v8::internal::FactoryBase<v8::internal::Factory>::NewStringFromOneByte(v8::base::Vector<unsigned char const> const&, v8::internal::AllocationType) [node]
Dec 25 01:11:56 12: 0x10d85db v8::internal::FactoryBase<v8::internal::Factory>::SmiToString(v8::internal::Smi, v8::internal::NumberCacheMode) [node]
Dec 25 01:11:56 13: 0x12e2fff [node]
Dec 25 01:11:56 14: 0x13af0b5 [node]
Dec 25 01:11:56 15: 0x13b51c3 v8::internal::KeyAccumulator::GetKeys(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::KeyCollectionMode, v8::internal::PropertyFilter, v8::internal::GetKeysConversion, bool, bool) [node]
Dec 25 01:11:56 16: 0x1548b99 v8::internal::Runtime_ObjectKeys(int, unsigned long*, v8::internal::Isolate*) [node]
Dec 25 01:11:56 17: 0x1979ef6 [node]
Dec 25 01:11:56 1: 0xb8ced1 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
Dec 25 01:11:56 2: 0xf06460 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
Dec 25 01:11:56 3: 0xf06747 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
Dec 25 01:11:56 4: 0x11182e5 [node]
Dec 25 01:11:56 5: 0x1130168 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
Dec 25 01:11:56 6: 0x1106281 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
Dec 25 01:11:56 7: 0x1107415 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
Dec 25 01:11:56 8: 0x10e3b36 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
Dec 25 01:11:56 9: 0x10d5764 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [node]
Dec 25 01:11:56 <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - <--- Last few GCs ---> <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - [1:0x2c7d5f70] 1163197 ms: Scavenge (reduce) 254.2 (257.3) -> 254.1 (258.3) MB, 14.76 / 0.00 ms (average mu = 0.987, current mu = 0.765) allocation failure; <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - [1:0x2c7d5f70] 1163482 ms: Mark-Compact (reduce) 255.1 (258.3) -> 255.1 (259.3) MB, 276.30 / 0.02 ms (+ 171.6 ms in 109 steps since start of marking, biggest step 39.1 ms, walltime since start of marking 703 ms) (average mu = 0.963, current mu = 0.578) <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - <--- JS stacktrace ---> <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 - ----- Native stack trace ----- <30>1 2024-12-24T20:11:56Z my.domain.tld dc00fba3-dfa6-4d42-b812-f562726a9ee4 1220 dc00fba3-dfa6-4d42-b812-f562726a9ee4 -

@Joffcom
Copy link
Member

Joffcom commented Dec 24, 2024

Hey @Bounz

Can you set N8N_DEFAULT_BINARY_DATA_MODE to filesystem and let me know if it helps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants