You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FATAL ERROR: v8::FromJust Maybe value is Nothing #6899
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();
}
}
$ 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)
#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
So, the Nothing is returned from Message::GetStartColumn
It can only happen when the execution of the JSFunctionmessage_get_column_number throws an exception.
The function is defined here:
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.
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.
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:
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)
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')
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)
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.
Reacted by Branko Stanković and Eduardo Ari Turconi
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.
Activity
markuskremer commentedon May 20, 2016
Reproduced on 32 bit 0.12.7 nodejs
Instead of SEGV, console.log is undefined.
addaleax commentedon May 20, 2016
debug build stack trace:
targos commentedon 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 commentedon May 20, 2016
@targos Hm, I’m looking into it too, and for me (x64, Linux) it reproduces it exactly as described above…
targos commentedon May 20, 2016
So, the
Nothingis returned from Message::GetStartColumnIt can only happen when the execution of the
JSFunctionmessage_get_column_numberthrows an exception.The function is defined here:
node/deps/v8/src/js/messages.js
Lines 208 to 215 in 7c3e920
addaleax commentedon May 20, 2016
Minimal reproduction:
I think what’s going on is that once the
RangeErroris thrown, there’s not enough stack space left for lazily compiling theconsolemodule… I am not entirely sure what to do about that.addaleax commentedon May 20, 2016
PR: #6907
24 remaining items
module: don't cache uninitialized builtins
capaj commentedon 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 commentedon Jul 11, 2022
Just randomly hit this myself. No clue what I did to cause this.
The command that caused this was
vitest runwhich is running my tests.CM-IV commentedon 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.
fireairforce commentedon Jul 18, 2022
I meet the same question, too~
pbeshai commentedon 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:
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 commentedon Aug 19, 2022
I also encountered this problem when using vitest again
bnoordhuis commentedon Aug 20, 2022
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 commentedon Aug 24, 2022
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 commentedon Aug 27, 2022
Just update vitest to the latest version, it worked for me
OmgImAlexis commentedon Aug 28, 2022
@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 commentedon Feb 13, 2023
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 commentedon Feb 13, 2023
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.
module: don't cache uninitialized builtins