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 #6899

Closed
markuskremer opened this issue May 20, 2016 · 19 comments
Closed

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

markuskremer opened this issue May 20, 2016 · 19 comments
Labels
confirmed-bug Issues with confirmed bugs. console Issues and PRs related to the console subsystem. vm Issues and PRs related to the vm subsystem.

Comments

@markuskremer
Copy link

markuskremer commented May 20, 2016

People coming here from search engines, read #6899 (comment)


segmentation fault when simple mqtt client tries to send 40kb data to broker.
4.x versions of node crash with "console.log is not a function"
Program does not crash when i remove the // before the first console.log.
Seems to work under 32 bit.

steps to reproduce:

$ npm install mqtt mosca
$ node_modules/.bin/mosca &
...
$ node crash.js 
FATAL ERROR: v8::FromJust Maybe value is Nothing.
Aborted (core dumped)

$ cat crash.js
var mqtt    = require('mqtt');
var client  = mqtt.connect('mqtt://localhost');
var todo=5000;

client.on('connect', function () {
//  console.log("WTF");
  client.subscribe('config/#');
  pubs();
});

function pubs()
{
  if(todo>0)
{
  todo-=1;
 client.publish('c/'+todo, '' ,pubs);
} else
{
  console.log("END");
  client.end();
}
}
@markuskremer
Copy link
Author

markuskremer commented May 20, 2016

Reproduced on 32 bit 0.12.7 nodejs
Instead of SEGV, console.log is undefined.

  • Version: 0.12.7
  • Platform: Linux 3.2.41-042stab111.12 SMP Thu Sep 17 11:38:20 MSK 2015 i686 GNU/Linux
  • Subsystem: debian 7
$ node --version
v0.12.7
$ grep  PRETTY /etc/os-release
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
$ uname -a
Linux  3.2.41-042stab111.12 #1 SMP Thu Sep 17 11:38:20 MSK 2015 i686 GNU/Linux
$ node crash.js
/home/markus/c/crash.js:21
  console.log("END");
          ^
TypeError: undefined is not a function
    at pubs (/home/markus/c/crash.js:21:11)
    at sendPacket (/home/markus/c/node_modules/mqtt/lib/client.js:41:7)
    at MqttClient._sendPacket (/home/markus/c/node_modules/mqtt/lib/client.js:628:7)
    at MqttClient.publish (/home/markus/c/node_modules/mqtt/lib/client.js:366:12)
    at pubs (/home/markus/c/crash.js:18:9)

@addaleax addaleax added the confirmed-bug Issues with confirmed bugs. label May 20, 2016
@addaleax
Copy link
Member

debug build stack trace:

#0  0x00007ffff6b79418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff6b7b01a in __GI_abort () at abort.c:89
#2  0x0000000001aaccb3 in node::OnFatalError (location=0x1dc0646 "v8::FromJust", message=0x1dc062e "Maybe value is Nothing.") at ../src/node.cc:2392
#3  0x000000000104bb41 in v8::Utils::ReportApiFailure (location=0x1dc0646 "v8::FromJust", message=0x1dc062e "Maybe value is Nothing.")
    at ../deps/v8/src/api.cc:307
#4  0x0000000001046de9 in v8::Utils::ApiCheck (condition=false, location=0x1dc0646 "v8::FromJust", message=0x1dc062e "Maybe value is Nothing.")
    at ../deps/v8/src/api.h:184
#5  0x000000000104cd84 in v8::V8::FromJustIsNothing () at ../deps/v8/src/api.cc:653
#6  0x00000000014ac433 in v8::Maybe<int>::FromJust (this=0x7ffffff08d70) at ../deps/v8/include/v8.h:6530
#7  0x0000000001aa907f in node::AppendExceptionLine (env=0x2a2d020, er=..., message=...) at ../src/node.cc:1524
#8  0x0000000001ad90e0 in node::ContextifyScript::DecorateErrorStack (env=0x2a2d020, try_catch=...) at ../src/node_contextify.cc:627
#9  0x0000000001ad8912 in node::ContextifyScript::New (args=...) at ../src/node_contextify.cc:511
#10 0x0000000001092eab in v8::internal::FunctionCallbackArguments::Call (this=0x7ffffff09e20, 
    f=0x1ad84c8 <node::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&)>) at ../deps/v8/src/arguments.cc:33
#11 0x000000000112afd5 in v8::internal::(anonymous namespace)::HandleApiCallHelper<true> (isolate=0x29efe60, args=...) at ../deps/v8/src/builtins.cc:3915
#12 0x000000000111be85 in v8::internal::Builtin_Impl_HandleApiCallConstruct (args=..., isolate=0x29efe60) at ../deps/v8/src/builtins.cc:3948
#13 0x000000000111bde4 in v8::internal::Builtin_HandleApiCallConstruct (args_length=4, args_object=0x7ffffff09ff8, isolate=0x29efe60)
    at ../deps/v8/src/builtins.cc:3945

@targos
Copy link
Member

targos commented May 20, 2016

@addaleax I'd like to investigate further. How did you reproduce the crash ?
The OP's testcase does nothing when I execute it

@addaleax
Copy link
Member

@targos Hm, I’m looking into it too, and for me (x64, Linux) it reproduces it exactly as described above…

@targos
Copy link
Member

targos commented May 20, 2016

So, the Nothing is returned from Message::GetStartColumn
It can only happen when the execution of the JSFunction message_get_column_number throws an exception.
The function is defined here:

//Returns the offset of the given position within the containing line.
function GetColumnNumber(message) {
var script = %MessageGetScript(message);
var start_position = %MessageGetStartPosition(message);
var location = script.locationFromPosition(start_position, true);
if (location == null) return -1;
return location.column;
}

@addaleax
Copy link
Member

Minimal reproduction:

function a() {
  try {
    a();
  } catch (e) {
    console.log(e);
  }
}

a();

I think what’s going on is that once the RangeError is thrown, there’s not enough stack space left for lazily compiling the console module… I am not entirely sure what to do about that.

@addaleax addaleax added vm Issues and PRs related to the vm subsystem. console Issues and PRs related to the console subsystem. labels May 20, 2016
@addaleax
Copy link
Member

PR: #6907

addaleax added a commit to addaleax/node that referenced this issue May 22, 2016
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.

Ref: nodejs#6899
addaleax added a commit to addaleax/node that referenced this issue May 22, 2016
Don't cache the exported values of fully uninitialized builtins.
This works by adding an additional `loading` flag that is only
active during initial loading of an internal module and checking
that either the module is fully loaded or is in that state before
using its cached value.

This has the effect that builtins modules which could not be loaded
(e.g. because compilation failed due to missing stack space) can be
loaded at a later point.

Fixes: nodejs#6899
addaleax added a commit that referenced this issue May 24, 2016
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.

Ref: #6899
PR-URL: #6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
addaleax added a commit to addaleax/node that referenced this issue May 25, 2016
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.

Ref: nodejs#6899
addaleax added a commit to addaleax/node that referenced this issue May 25, 2016
Don't cache the exported values of fully uninitialized builtins.
This works by adding an additional `loading` flag that is only
active during initial loading of an internal module and checking
that either the module is fully loaded or is in that state before
using its cached value.

This has the effect that builtins modules which could not be loaded
(e.g. because compilation failed due to missing stack space) can be
loaded at a later point.

Fixes: nodejs#6899
Fishrock123 pushed a commit to Fishrock123/node that referenced this issue May 30, 2016
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.

Ref: nodejs#6899
PR-URL: nodejs#6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fishrock123 pushed a commit to Fishrock123/node that referenced this issue May 30, 2016
Don't cache the exported values of fully uninitialized builtins.
This works by adding an additional `loading` flag that is only
active during initial loading of an internal module and checking
that either the module is fully loaded or is in that state before
using its cached value.

This has the effect that builtins modules which could not be loaded
(e.g. because compilation failed due to missing stack space) can be
loaded at a later point.

Fixes: nodejs#6899
PR-URL: nodejs#6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit that referenced this issue Jun 2, 2016
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.

Ref: #6899
PR-URL: #6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit that referenced this issue Jun 2, 2016
Don't cache the exported values of fully uninitialized builtins.
This works by adding an additional `loading` flag that is only
active during initial loading of an internal module and checking
that either the module is fully loaded or is in that state before
using its cached value.

This has the effect that builtins modules which could not be loaded
(e.g. because compilation failed due to missing stack space) can be
loaded at a later point.

Fixes: #6899
PR-URL: #6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this issue Jun 30, 2016
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.

Ref: #6899
PR-URL: #6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this issue Jun 30, 2016
Don't cache the exported values of fully uninitialized builtins.
This works by adding an additional `loading` flag that is only
active during initial loading of an internal module and checking
that either the module is fully loaded or is in that state before
using its cached value.

This has the effect that builtins modules which could not be loaded
(e.g. because compilation failed due to missing stack space) can be
loaded at a later point.

Fixes: #6899

Ref: #6899
PR-URL: #6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
Make less assumptions about what objects will be available when
vm context creation or error message printing fail because V8
runs out of JS stack space.

Ref: #6899
PR-URL: #6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
Don't cache the exported values of fully uninitialized builtins.
This works by adding an additional `loading` flag that is only
active during initial loading of an internal module and checking
that either the module is fully loaded or is in that state before
using its cached value.

This has the effect that builtins modules which could not be loaded
(e.g. because compilation failed due to missing stack space) can be
loaded at a later point.

Fixes: #6899

Ref: #6899
PR-URL: #6907
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@capaj
Copy link

capaj commented Jun 5, 2018

I just got this today with node 8.11.1. It happens when I do an infinite recursion in my graphQL resolver. The resolver is probably called as function and awaited.

I'll probably setup a small repro repo and report it as a new issue.

@OmgImAlexis
Copy link

Just randomly hit this myself. No clue what I did to cause this.

The command that caused this was vitest run which is running my tests.

FATAL ERROR: v8::FromJust Maybe value is Nothing.
 1: 00007FF6422194EF node_api_throw_syntax_error+174703
 2: 00007FF6421A79C6 v8::internal::wasm::WasmCode::safepoint_table_offset+67350
 3: 00007FF6421A889D node::OnFatalError+301
 4: 00007FF642C25335 v8::api_internal::FromJustIsNothing+53
 5: 00007FF6421902A2 v8::base::CPU::has_fpu+37538
 6: 00007FF64227B297 uv_timer_stop+1207
 7: 00007FF64227783B uv_async_send+331
 8: 00007FF642276FCC uv_loop_init+1292
 9: 00007FF64227716A uv_run+202
10: 00007FF642246065 node::SpinEventLoop+309
11: 00007FF6420DD200 v8::internal::wasm::SignatureMap::Freeze+36000
12: 00007FF6420D8918 v8::internal::wasm::SignatureMap::Freeze+17336
13: 00007FF64226783D uv_poll_stop+557
14: 00007FF643220D70 v8::internal::compiler::ToString+145936
15: 00007FFDEC273FED BaseThreadInitThunk+29
16: 00007FFDED2742A8 RtlUserThreadStart+40

@CM-IV
Copy link

CM-IV commented Jul 14, 2022

Same here @OmgImAlexis

Using Vitejs 3.0.0 and Vitest 0.18.0

My tests seem to be passing, but there are 3 unhandled rejection errors.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: 
 ❯ post node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/worker.mjs:70:14
 ❯ node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-vite-node-utils.af8ead96.mjs:9149:11
 ❯ sendCall node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-vite-node-utils.af8ead96.mjs:9146:16
 ❯ node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-runtime-rpc.cc6a06a2.mjs:7:55
      5|   return new Proxy(rpc2, {
      6|     get(target, p, handler) {
      7|       const sendCall = Reflect.get(target, p, handler);
       |                                                       ^
      8|       const safeSendCall = (...args) => withSafeTimers(() => sendCall(...args));
      9|       safeSendCall.asEvent = sendCall.asEvent;
 ❯ withSafeTimers node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-utils-global.1b22c4fd.mjs:472:20
 ❯ Proxy.safeSendCall node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-runtime-rpc.cc6a06a2.mjs:7:41
 ❯ process.<anonymous> node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/worker.mjs:34:11
 ❯ process.emit node:events:527:28
 ❯ emit node:internal/process/promises:140:20
FATAL ERROR: v8::FromJust Maybe value is Nothing.
 1: 0xb09c10 node::Abort() [node]
 2: 0xa1c193 node::FatalError(char const*, char const*) [node]
 3: 0xcf8afa v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: 0xb0da7d node::fs::FileHandle::CloseReq::Resolve() [node]
 5: 0xb0dbd9  [node]
 6: 0x156015d  [node]
 7: 0x1564936  [node]
 8: 0x1577064  [node]
 9: 0x1565288 uv_run [node]
10: 0xa43dd5 node::SpinEventLoop(node::Environment*) [node]
11: 0xbd3792 node::worker::Worker::Run() [node]
12: 0xbd3f28  [node]
13: 0x7fc9ba434e2d  [/lib64/libc.so.6]
14: 0x7fc9ba4ba620  [/lib64/libc.so.6]

@fireairforce
Copy link

I meet the same question, too~

@pbeshai
Copy link

pbeshai commented Aug 10, 2022

Just want to chime in with my vitest experience – I ran into the same obscure errors and was able to resolve them by fixing the following:

  1. making sure every file in my package had no circular imports (e.g. no import { foo } from "../index.js" in bar.js where bar is also exported in ../index.js)
  2. making sure every file in my package didn't use directory imports (e.g. no import { foo } from '../' or some other implicit index file) and included file extensions (e.g. import { foo } from './foo.js')
  3. making sure every dependency was installed (e.g. I had changed lodash to lodash.throttle but hadn't npm installed during my debugging madness–this also produced incomprehensible errors)

I was able to debug/verify the changes by editing the files in node_modules directly until they worked (and updated the package src afterward – this was just faster for me than doing the build for each change)

@Duo-Huang
Copy link

I also encountered this problem when using vitest again

@bnoordhuis
Copy link
Member

This year's commenters: you're commenting on an old report that just happens to have the same generic error message in it. It's almost certainly not the same bug though, too much water has passed under too many bridges for that.

See #43304 for a more recent report. There's an excellent chance it's already fixed in the latest release.

@OmgImAlexis
Copy link

I'm still getting the same issue, that post you linked to states it's fixed but using a newer version of node still throws this.

@Radinax
Copy link

Radinax commented Aug 27, 2022

Just update vitest to the latest version, it worked for me

@OmgImAlexis
Copy link

@Radinax I've updated to 0.22.1 (just a tip "the latest version" isn't helpful as that changes on every update). The issue still occurs.

@sabithakuppusamy
Copy link

Yes, I was facing this issue with Vitest 0.25.8 and node v18.0.0 in NX.

I managed to fix this issue by cleaning the npm cache and downgrading to node version 16,

npm cache clean --force
nvm use 16

@bnoordhuis
Copy link
Member

I'm going to lock this. This is one of those issues that show up high in search rankings but as I mentioned in #6899 (comment), it's a generic error message - in 2023 you're not hitting the bug that was found and fixed in 2016.

If you're still seeing that error message with recent releases (and note: v18.0.0 does not count as recent, that would be v18.14.0 at the time of writing), then please open new issues with steps to reproduce, preferably without involving third-party dependencies.

@nodejs nodejs locked as resolved and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
confirmed-bug Issues with confirmed bugs. console Issues and PRs related to the console subsystem. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

No branches or pull requests