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

FATAL ERROR: v8::FromJust Maybe value is Nothing #43304

Open
RatanRSur opened this issue Jun 3, 2022 · 11 comments
Open

FATAL ERROR: v8::FromJust Maybe value is Nothing #43304

RatanRSur opened this issue Jun 3, 2022 · 11 comments
Labels
lib / src Issues and PRs related to general changes in the lib or src directory.

Comments

@RatanRSur
Copy link

Version

v16.14.0

Platform

Darwin 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

Running yarn test in debug console in visual studio code

How often does it reproduce? Is there a required condition?

Everytime

What is the expected behavior?

No response

What do you see instead?

FATAL ERROR: v8::FromJust Maybe value is Nothing.
 1: 0x10415a260 node::Abort() [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 2: 0x10415a3e8 node::errors::TryCatchScope::~TryCatchScope() [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 3: 0x1042aabc8 v8::V8::FromJustIsNothing() [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 4: 0x104203174 node::ReportWritesToJSStreamListener::OnStreamAfterReqFinished(node::StreamReq*, int) [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 5: 0x1042031d0 node::ShutdownWrap::OnDone(int) [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 6: 0x104207640 node::LibuvStreamWrap::AfterUvShutdown(uv_shutdown_s*, int) [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 7: 0x1049d53e8 uv__stream_io [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 8: 0x1049dcf70 uv__io_poll [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
 9: 0x1049cb688 uv_run [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
10: 0x1040a7ccc node::SpinEventLoop(node::Environment*) [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
11: 0x1041ec598 node::worker::Worker::Run() [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
12: 0x1041ef7c0 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/rai/.nvm/versions/node/v16.14.0/bin/node]
13: 0x18afec26c _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
14: 0x18afe708c thread_start [/usr/lib/system/libsystem_pthread.dylib]

Additional information

No response

@airtable-keyhanvakil
Copy link
Contributor

Possibly already fixed in #42874.

@ashishchandr70
Copy link

Do you know @airtable-keyhanvakil where this landed i.e. which version was it applied to and whether it covers Node.js 14.x?

@airtable-keyhanvakil
Copy link
Contributor

@ashishchandr70 It looks to be in v18.2.0. I asked about how to get it backported to earlier branches in that PR.

@Radinax
Copy link

Radinax commented Aug 27, 2022

I had this issue with vitest, I just updated it to the latest version "vitest": "^0.22.1" and it works now

@OmgImAlexis
Copy link

OmgImAlexis commented Sep 7, 2022

Similar issue yet again in vitest@0.23.1 on node@v18.3.0.

This happened after hitting RangeError: Maximum call stack size exceeded in one of my tests.

FATAL ERROR: v8::FromJust Maybe value is Nothing.
 1: 00007FF7A83C94EF node_api_throw_syntax_error+174703
 2: 00007FF7A83579C6 v8::internal::wasm::WasmCode::safepoint_table_offset+67350
 3: 00007FF7A835889D node::OnFatalError+301
 4: 00007FF7A8DD5335 v8::api_internal::FromJustIsNothing+53
 5: 00007FF7A83F1AE0 node::UVException+912
 6: 00007FF7A8341EC9 v8::base::CPU::has_fpu+44745
 7: 00007FF7A842B297 uv_timer_stop+1207
 8: 00007FF7A842783B uv_async_send+331
 9: 00007FF7A8426FCC uv_loop_init+1292
10: 00007FF7A842716A uv_run+202
11: 00007FF7A83F6065 node::SpinEventLoop+309
12: 00007FF7A828D200 v8::internal::wasm::SignatureMap::Freeze+36000
13: 00007FF7A8288918 v8::internal::wasm::SignatureMap::Freeze+17336
14: 00007FF7A841783D uv_poll_stop+557
15: 00007FF7A93D0D70 v8::internal::compiler::ToString+145936
16: 00007FFBAAFD458D BaseThreadInitThunk+29
17: 00007FFBACE57558 RtlUserThreadStart+40

Original comment: #6899 (comment)

@targos
Copy link
Member

targos commented Sep 7, 2022

It would be useful if someone could provide a simple way to reproduce the crash.

@targos targos added v8 engine Issues and PRs related to the V8 dependency. lib / src Issues and PRs related to general changes in the lib or src directory. and removed v8 engine Issues and PRs related to the V8 dependency. labels Sep 7, 2022
RandomByte added a commit to SAP/ui5-builder that referenced this issue Jul 12, 2023
This is to workaround for the
"FATAL ERROR: v8::FromJust Maybe value is Nothing." errors we see for
our Windows and macOS test executions on Azure.

The error is sporadic, but most consistently appears on Windows 2022
(Azure image '20230630.1.0' and Node v18.16.1.

avajs/ava#2947 seems to suggest this is a
Node.js issue as reported at nodejs/node#43304

Disabling the use of our own worker threads in minifier.js resolve the
issue. Disabling worker threads in AVA resolves it too.

Since we want to test our worker threads, we opted for the latter by
setting the AVA option '--no-worker-threads' for all scripts executed in
Azure.

All this indicates an issue with using worker threads (or the workerpool
package) from within workers.
RandomByte added a commit to SAP/ui5-builder that referenced this issue Jul 13, 2023
This is to workaround for the
"FATAL ERROR: v8::FromJust Maybe value is Nothing." errors we see for
our Windows and macOS test executions on Azure.

The error is sporadic, but most consistently appears on Windows 2022
(Azure image '20230630.1.0' and Node v18.16.1.

avajs/ava#2947 seems to suggest this is a
Node.js issue as reported at nodejs/node#43304

Disabling the use of our own worker threads in minifier.js resolve the
issue. Disabling worker threads in AVA resolves it too.

Since we want to test our worker threads, we opted for the latter by
setting the AVA option '--no-worker-threads' for all scripts executed in
Azure.

All this indicates an issue with using worker threads (or the workerpool
package) from within workers.
@ImLunaHey
Copy link

Here's a small reproducible code sample. This crashes with the error 1/5 times for me. If I keep running this over and over I consistently get the crash.

import { createApplication, Request } from '@nbit/bun';
import { expect, test } from 'vitest';

const home = () => ({ hello: 'world' });

const { defineRoutes, createRequestHandler } = createApplication();

const routes = defineRoutes(app => [
    app.get('/', home),
]);

const requestHandler = createRequestHandler(routes);

test('should return the home page', async () => {
    const request = new Request('http://localhost/');
    const response = await requestHandler(request);
    expect(response.status).toBe(200);
});
➜  vote git:(main) ✗ bun run test
$ vitest run --coverage

 RUN  v0.34.1 /Users/xo/code/ImLunaHey/vote
      Coverage enabled with v8

 ✓ src/handlers/home.test.ts (1)
   ✓ should return the home page

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  20:40:20
   Duration  754ms (transform 77ms, setup 0ms, collect 77ms, tests 8ms, environment 0ms, prepare 160ms)

 % Coverage report from v8
-----------------------|---------|----------|---------|---------|-------------------
File                   | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-----------------------|---------|----------|---------|---------|-------------------
All files              |       0 |        0 |       0 |       0 |                   
 src                   |       0 |        0 |       0 |       0 |                   
  application.ts       |       0 |        0 |       0 |       0 | 1-9               
  index.ts             |       0 |        0 |       0 |       0 | 1-11              
  things-to-vote-on.ts |       0 |        0 |       0 |       0 | 1-90              
 src/handlers          |       0 |        0 |       0 |       0 |                   
  home.ts              |       0 |        0 |       0 |       0 | 1-22              
  index.ts             |       0 |        0 |       0 |       0 | 1-2               
  vote.tsx             |       0 |        0 |       0 |       0 | 1-135             
-----------------------|---------|----------|---------|---------|-------------------
FATAL ERROR: v8::FromJust Maybe value is Nothing.
 1: 0x10e451a95 node::Abort() (.cold.1) [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 2: 0x10cf19419 node::Abort() [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 3: 0x10cf1958f node::OnFatalError(char const*, char const*) [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 4: 0x10d0a2c60 v8::api_internal::FromJustIsNothing() [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 5: 0x10cf1ca94 node::fs::FileHandle::CloseReq::Resolve() [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 6: 0x10cf31e4a node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 7: 0x10d9cc578 uv__work_done [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 8: 0x10d9d173b uv__async_io [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
 9: 0x10d9e552b uv__io_poll [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
10: 0x10d9d1cc1 uv_run [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
11: 0x10ce49f9f node::SpinEventLoop(node::Environment*) [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
12: 0x10cfc64d8 node::worker::Worker::Run() [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
13: 0x10cfc9e22 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/xo/.nvm/versions/node/v18.3.0/bin/node]
14: 0x7ff81004c4e1 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
15: 0x7ff810047f6b thread_start [/usr/lib/system/libsystem_pthread.dylib]
error: script "test" exited with code 6 (SIGABRT)

@bnoordhuis
Copy link
Member

@ImLunaHey can you try with the latest v18.x? v18.3.0 is pretty old by now.

A test case without third-party dependencies would help too. import "vitest" probably pulls in the world and then some.

@ImLunaHey
Copy link

I believe vitest is part of the issue. Running this in node or bun with node or bun's built-in testing framework for example doesn't produce this error.

@madeleineostoja
Copy link

madeleineostoja commented Nov 7, 2023

@ImLunaHey does disabling multi threading (vitest run --coverage --no-threads) fix the issue? And does removing --coverage fix it? Both of those hacks worked for me, wondering if there's an issue with multithreading and coverage in vitest

@intellild
Copy link

I join the problem with 20.15.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

No branches or pull requests

10 participants