Skip to content

Crashes during repeated execution within node worker #344

@Domysee

Description

@Domysee

impit version: 0.7.5
OS: Windows 11, Ubuntu 24.04 (happens on both)
node version: 24.12.0 (Windows 11), 24.9.0 (Ubuntu)

I'm running impit in a node worker thread, doing hundreds of requests per second.
At random times it panics and prints the following errors:

thread 'tokio-runtime-worker' (25376) panicked at impit-node\src\response.rs:91:59:
called `Result::unwrap()` on an `Err` value: ToStrError { _priv: () }
stack backtrace:
   0:     0x7ffebae77fb2 - napi_register_module_v1
   1:     0x7ffebabfc93a - <unknown>
   2:     0x7ffebae766f4 - napi_register_module_v1
   3:     0x7ffebae77c04 - napi_register_module_v1
   4:     0x7ffebae7630a - napi_register_module_v1
   5:     0x7ffebae7ccf9 - napi_register_module_v1
   6:     0x7ffebae7cc4f - napi_register_module_v1
   7:     0x7ffebae7cc3e - napi_register_module_v1
   8:     0x7ffebb026001 - napi_register_module_v1
   9:     0x7ffebb0265a0 - napi_register_module_v1
  10:     0x7ffebab91604 - <unknown>
  11:     0x7ffebabb0bd0 - <unknown>
  12:     0x7ffebabe0995 - <unknown>
  13:     0x7ffebabdd594 - <unknown>
  14:     0x7ffebae862aa - napi_register_module_v1
  15:     0x7ffebae8e87e - napi_register_module_v1
  16:     0x7ffebae8a328 - napi_register_module_v1
  17:     0x7ffebae89d27 - napi_register_module_v1
  18:     0x7ffebae899de - napi_register_module_v1
  19:     0x7ffebae7fded - napi_register_module_v1
  20:     0x7fffc059e8d7 - BaseThreadInitThunk
  21:     0x7fffc0ecc53c - RtlUserThreadStart
thread '<unnamed>' (22244) panicked at impit\src\response_parsing\mod.rs:57:52:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7ffebae77fb2 - napi_register_module_v1
   1:     0x7ffebabfc93a - <unknown>
   2:     0x7ffebae766f4 - napi_register_module_v1
   3:     0x7ffebae77c04 - napi_register_module_v1
   4:     0x7ffebae7630a - napi_register_module_v1
   5:     0x7ffebae7ccc2 - napi_register_module_v1
   6:     0x7ffebae7cc4f - napi_register_module_v1
   7:     0x7ffebae7cc3e - napi_register_module_v1
   8:     0x7ffebb026001 - napi_register_module_v1
   9:     0x7ffebb02604d - napi_register_module_v1
  10:     0x7ffebb025e4e - napi_register_module_v1
  11:     0x7ffebaba41d5 - <unknown>
  12:     0x7ff65d454e71 - napi_is_detached_arraybuffer
  13:      0x222216cf64d - <unknown>
  14:      0x22201aa39a0 - <unknown>
  15:      0x22221710c7b - <unknown>
  16:      0x222217fa9b5 - <unknown>
  17:      0x222216fed47 - <unknown>
  18:      0x222216cb67b - <unknown>
  19:     0x7ff65ded7736 - OPENSSL_version_minor
  20:     0x7ff65ded8275 - OPENSSL_version_minor
  21:     0x7ff65ded8462 - OPENSSL_version_minor
  22:     0x7ff65dea774b - v8::Unlocker::~Unlocker
  23:     0x7ff65dea8001 - v8::Unlocker::~Unlocker
  24:     0x7ff65d4eeb58 - node::CallbackScope::~CallbackScope
  25:     0x7ff65d4ee8c0 - node::CallbackScope::~CallbackScope
  26:     0x7ff65d42f947 - node_api_create_buffer_from_arraybuffer
  27:     0x7ff65e08acbb - uv_run
  28:     0x7ff65e08a82f - uv_run
  29:     0x7ff65d4ed01f - node::DecodeWrite
  30:     0x7ff65d245511 - RSA_meth_get_flags
  31:     0x7ff65d24ec30 - RSA_meth_get_flags
  32:     0x7ff65e078646 - uv_thread_detach
  33:     0x7ff65f2b9fb3 - v8::base::UnsignedDivisionByConstant<unsigned __int64>
  34:     0x7fffc059e8d7 - BaseThreadInitThunk
  35:     0x7fffc0ecc53c - RtlUserThreadStart

With the latter the whole node process crashed, with the former the node process continued.
It seems to occur randomly, and when doing the requests with Postman later, the responses look fine.
I tried to replicate it, fetching the URL (https://ajudaily.com/?format=rss) in a separate project, but couldn't reproduce the panic.
It also occurred when doing only 1 request in parallel.

Creating a new impit instance for every request seemed to make it more stable, especially when doing only 1 request in parallel. Though that's only anecdotally.

Maybe of note, the network uses a Technitium DNS server.

new Impit({
        browser: "chrome",
        timeout: 30000,
        vanillaFallback: true,
      })
        .fetch(item.url)

This is how I use it currently. I had a shared instance before, but creating new ones proved more resilient. As far as I can tell until now, creating new instances still causes the error, but doesn't crash the node process. With a shared instance sometimes the error would crash the entire process (not just the worker, but the whole application).

Since I cannot reliably replicate the error, I'm not sure if I can provide any more information. If there is anything, please let me know.
I know this is kind of vague, so please feel free to close it if it doesn't provide value.

Metadata

Metadata

Assignees

Labels

t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions