postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.83k stars 1.16k forks source link

Newman failed on Invalid array length when the response body greater than 100MB #3268

Open gilb77 opened 3 weeks ago

gilb77 commented 3 weeks ago

Version and environment information:

  1. Newman Version: 6.1.3
  2. OS details: mac m1
  3. Are you using Newman as a library, or via the CLI? Using as library
  4. Did you encounter this recently, or has this bug always been there: i think always was there
  5. Expected behaviour: The collection complete to run without issues
  6. Command / script used to run Newman: Run request which receives a file greater than 100MB with the test script

Steps to reproduce the problem:

  1. Create a new GET request like this one to download file that is greater than 100MB GET /data/v60.0/sobjects/file/0ATewrewrweoHOAW Host: test.my.postman.com

  2. Add a test script to this request with this line, for example: console.log("------------------ Hello World ----------------");

  3. Run the collection from newman lib

The collection did not reach the script and failed on different errors according to the NodJS version, To workaround this error, I copied the response.stream to the collection variable and deleted it from the stream. If I wanted to call the async function in the request event, I should change the response.stream reference to a new variable; otherwise, even if I deleted the buffer from response.stream and called to async function, it failed.

In NodeJs version 22.6.0, the service will throw this error:

Error: Invalid array length
    at Array.push (<anonymous>)
    at S (evalmachine.<anonymous>:66:1986633)
    at Uint8Array.m (evalmachine.<anonymous>:66:1983891)
    at s.toString (evalmachine.<anonymous>:66:1989655)
    at i.text (evalmachine.<anonymous>:66:1733359)
    at i.write (evalmachine.<anonymous>:66:1732903)
    at o.write (evalmachine.<anonymous>:66:1433745)
    at r.write (evalmachine.<anonymous>:66:1553175)
    at o.decode (evalmachine.<anonymous>:66:1553828)
    at Object.bufferOrArrayBufferToString (evalmachine.<anonymous>:66:1422384)

In NodeJs version 20.12.2, the service will crash with the following logs:

#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804 (see [crbug.com/1201626](http://crbug.com/1201626))
#
#
#
#FailureMessage Object: 0x178757c18
----- Native stack trace -----
 1: 0x10228772c node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 2: 0x10332dcd4 V8_Fatal(char const*, ...) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 3: 0x10254d94c v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 4: 0x1026e9580 v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedSmiElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)0>>::GrowCapacity(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 5: 0x102934c18 v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 6: 0x102ca0c44 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 7: 0x5b02e1a24
 8: 0x5b030f308
 9: 0x5b0414c48
10: 0x5b022fe20
11: 0x5b042712c
12: 0x5b040ef30
13: 0x5b0421e0c
14: 0x5b02f6858
15: 0x5b040f180
16: 0x5b040c684
17: 0x5b04137e0
18: 0x5b0399f50
19: 0x5b025ebb0
20: 0x5b02537b4
21: 0x102cb8b3c Builtins_ArrayForEach [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
22: 0x5b0253a48
23: 0x5b0253b7c
24: 0x102c183e4 Builtins_InterpreterEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
25: 0x102c183e4 Builtins_InterpreterEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
26: 0x102c1650c Builtins_JSEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
27: 0x102c161f4 Builtins_JSEntry [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
28: 0x1024ecb10 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
29: 0x1024ecce8 v8::internal::Execution::CallScript(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
30: 0x1023b2c84 v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::Data>) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
31: 0x10220de68 node::contextify::ContextifyScript::EvalMachine(v8::Local<v8::Context>, node::Environment*, long long, bool, bool, bool, v8::MicrotaskQueue*, v8::FunctionCallbackInfo<v8::Value> const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
32: 0x10220d890 node::contextify::ContextifyScript::RunInContext(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
33: 0x102418c9c v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
34: 0x102418394 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
35: 0x102ca0b24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
36: 0x5b0222218
37: 0x5b0213d6c
38: 0x5b0262bf4
39: 0x5b038a888
40: 0x5b0266214
41: 0x5b0264eb0
42: 0x5b011bb0c
43: 0x5b00ab1e8
44: 0x5b02b0ac0
45: 0x5b02333f0
46: 0x5b0116678
47: 0x5b023349c
48: 0x5b0116678
49: 0x5b0253ddc
50: 0x5b0253ec0
51: 0x5b0116678
52: 0x5b039c7ec
53: 0x5b0227c70
54: 0x5b026a9fc
55: 0x5b038ab34
56: 0x5b02555f8
57: 0x5b02193dc
58: 0x102c1650c Builtins_JSEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
59: 0x102c161f4 Builtins_JSEntry [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
60: 0x1024ecb10 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
61: 0x1024ebf5c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
62: 0x1023c69d8 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
63: 0x1021bee48 node::Environment::RunTimers(uv_timer_s*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
64: 0x102bf3358 uv__run_timers [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
65: 0x102bf6bb8 uv_run [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
66: 0x1021496f0 node::SpinEventLoopInternal(node::Environment*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
67: 0x1022da04c node::worker::Worker::Run() [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
68: 0x1022dd2a4 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
69: 0x183dc6f94 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
70: 0x183dc1d34 thread_start [/usr/lib/system/libsystem_pthread.dylib]
HackJJ commented 3 weeks ago

I think I'm experiencing the same: https://github.com/postmanlabs/postman-app-support/issues/13086

A1811-qbite commented 1 week ago

Version and environment information:

  1. Newman Version: 6.1.3
  2. OS details: mac m1
  3. Are you using Newman as a library, or via the CLI? Using as library
  4. Did you encounter this recently, or has this bug always been there: i think always was there
  5. Expected behaviour: The collection complete to run without issues
  6. Command / script used to run Newman: Run request which receives a file greater than 100MB with the test script

Steps to reproduce the problem:

  1. Create a new GET request like this one to download file that is greater than 100MB GET /data/v60.0/sobjects/file/0ATewrewrweoHOAW Host: test.my.postman.com

  2. Add a test script to this request with this line, for example: console.log("------------------ Hello World ----------------");

  3. Run the collection from newman lib

The collection did not reach the script and failed on different errors according to the NodJS version, To workaround this error, I copied the response.stream to the collection variable and deleted it from the stream. If I wanted to call the async function in the request event, I should change the response.stream reference to a new variable; otherwise, even if I deleted the buffer from response.stream and called to async function, it failed.

In NodeJs version 22.6.0, the service will throw this error:

Error: Invalid array length
    at Array.push (<anonymous>)
    at S (evalmachine.<anonymous>:66:1986633)
    at Uint8Array.m (evalmachine.<anonymous>:66:1983891)
    at s.toString (evalmachine.<anonymous>:66:1989655)
    at i.text (evalmachine.<anonymous>:66:1733359)
    at i.write (evalmachine.<anonymous>:66:1732903)
    at o.write (evalmachine.<anonymous>:66:1433745)
    at r.write (evalmachine.<anonymous>:66:1553175)
    at o.decode (evalmachine.<anonymous>:66:1553828)
    at Object.bufferOrArrayBufferToString (evalmachine.<anonymous>:66:1422384)

In NodeJs version 20.12.2, the service will crash with the following logs:

#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804 (see [crbug.com/1201626](http://crbug.com/1201626))
#
#
#
#FailureMessage Object: 0x178757c18
----- Native stack trace -----
 1: 0x10228772c node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 2: 0x10332dcd4 V8_Fatal(char const*, ...) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 3: 0x10254d94c v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 4: 0x1026e9580 v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedSmiElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)0>>::GrowCapacity(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 5: 0x102934c18 v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 6: 0x102ca0c44 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
 7: 0x5b02e1a24
 8: 0x5b030f308
 9: 0x5b0414c48
10: 0x5b022fe20
11: 0x5b042712c
12: 0x5b040ef30
13: 0x5b0421e0c
14: 0x5b02f6858
15: 0x5b040f180
16: 0x5b040c684
17: 0x5b04137e0
18: 0x5b0399f50
19: 0x5b025ebb0
20: 0x5b02537b4
21: 0x102cb8b3c Builtins_ArrayForEach [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
22: 0x5b0253a48
23: 0x5b0253b7c
24: 0x102c183e4 Builtins_InterpreterEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
25: 0x102c183e4 Builtins_InterpreterEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
26: 0x102c1650c Builtins_JSEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
27: 0x102c161f4 Builtins_JSEntry [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
28: 0x1024ecb10 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
29: 0x1024ecce8 v8::internal::Execution::CallScript(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
30: 0x1023b2c84 v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::Data>) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
31: 0x10220de68 node::contextify::ContextifyScript::EvalMachine(v8::Local<v8::Context>, node::Environment*, long long, bool, bool, bool, v8::MicrotaskQueue*, v8::FunctionCallbackInfo<v8::Value> const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
32: 0x10220d890 node::contextify::ContextifyScript::RunInContext(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
33: 0x102418c9c v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
34: 0x102418394 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
35: 0x102ca0b24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
36: 0x5b0222218
37: 0x5b0213d6c
38: 0x5b0262bf4
39: 0x5b038a888
40: 0x5b0266214
41: 0x5b0264eb0
42: 0x5b011bb0c
43: 0x5b00ab1e8
44: 0x5b02b0ac0
45: 0x5b02333f0
46: 0x5b0116678
47: 0x5b023349c
48: 0x5b0116678
49: 0x5b0253ddc
50: 0x5b0253ec0
51: 0x5b0116678
52: 0x5b039c7ec
53: 0x5b0227c70
54: 0x5b026a9fc
55: 0x5b038ab34
56: 0x5b02555f8
57: 0x5b02193dc
58: 0x102c1650c Builtins_JSEntryTrampoline [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
59: 0x102c161f4 Builtins_JSEntry [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
60: 0x1024ecb10 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
61: 0x1024ebf5c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
62: 0x1023c69d8 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
63: 0x1021bee48 node::Environment::RunTimers(uv_timer_s*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
64: 0x102bf3358 uv__run_timers [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
65: 0x102bf6bb8 uv_run [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
66: 0x1021496f0 node::SpinEventLoopInternal(node::Environment*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
67: 0x1022da04c node::worker::Worker::Run() [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
68: 0x1022dd2a4 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/user/.nvm/versions/node/v20.12.2/bin/node]
69: 0x183dc6f94 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
70: 0x183dc1d34 thread_start [/usr/lib/system/libsystem_pthread.dylib]