question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FATAL ERROR: v8::FromJust Maybe value is Nothing

See original GitHub issue

After upgrading newrelic from latest 8.x to 9.7.4 we are getting unexpected application crashes when running newrelic inside a worker_thread.

I was able to track down a little bit more and it reproduces on 9.1.0 but works fine on 9.0.0

Description

Getting unexpected crashes with the following call stack:

FATAL ERROR: v8::FromJust Maybe value is Nothing. 1: 0xb17ec0 node::Abort() [node] 2: 0xa341f4 node::FatalError(char const*, char const*) [node] 3: 0xcfe46a v8::Utils::ReportApiFailure(char const*, char const*) [node] 4: 0xb1bb1d node::fs::FileHandle::CloseReq::Resolve() [node] 5: 0xb1bc79 [node] 6: 0x158ab2d [node] 7: 0x158f186 [node] 8: 0x15a1f15 [node] 9: 0x158fab8 uv_run [node] 10: 0xa59f25 node::SpinEventLoop(node::Environment*) [node] 11: 0xbdd23a node::worker::Worker::Run() [node] 12: 0xbdd9c8 [node] 13: 0x7f0b450e2b43 [/lib/x86_64-linux-gnu/libc.so.6] 14: 0x7f0b45174a00 [/lib/x86_64-linux-gnu/libc.so.6] Aborted (core dumped)

This one is also being triggered:

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. 1: 0xb17ec0 node::Abort() [node] 2: 0xa341f4 node::FatalError(char const*, char const*) [node] 3: 0xcfe46a v8::Utils::ReportApiFailure(char const*, char const*) [node] 4: 0xb12f19 node::fs::FSReqPromise<node::AliasedBufferBase<double, v8::Float64Array, void> >::SetReturnValue(v8::FunctionCallbackInfov8::Value const&) [node] 5: 0xb240ca [node] 6: 0xd655cb [node] 7: 0xd66a6c [node] 8: 0xd670e6 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node] 9: 0x16148d9 [node] Aborted (core dumped)

Expected Behavior

It should be working fine as on 8.x version

Steps to Reproduce

I isolated the problem just by spawning a thread in loop that just calls newrelic and returns a simple result. The code crashes with latest 9.7.4 after some time whereas works fine with latest 8.x

The code uses https://github.com/andywer/threads.js/ to spawn the thread, but it’s using native nodeJS workers under the hood.

main.js

const newrelic = require('newrelic');
const {spawn, Thread, Worker } = require('threads');

launchChildThread = async function() {
    while (true) {
        const thread = await spawn(new Worker('./worker'));
        try {
            newrelic.incrementMetric('triggers', 1);
            const result = await thread.doStuff();
            console.log(`received success: ${result.success}`)
        } finally {
            await Thread.terminate(thread);
        }    
    }
}

launchChildThread();

worker.js

const newrelic = require('newrelic');
const { expose } = require('threads');

expose({
    async doStuff() {
        console.log('worker:doStuff');
        newrelic.startBackgroundTransaction('background transaction');
        await new Promise(resolve => setTimeout(resolve, 1000));
        newrelic.incrementMetric('executions', 1);
        return {success: true};
    }
});

Your Environment

  • NodeJS 16 / NodeJS 18
  • Ubuntu 20.04
  • Alpine Linux (node:16 image)

Additional context

I tried to call shutdown() method from newrelic in the worker thread before return statement, but it doesn’t seem to have any effect.

I suspect the problem is happening when calling Thread.terminate as the last printed logs are from there, but it’s crashing the main process. I suspect there may be something pending to flush from newrelic while releasing the memory.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bizob2828commented, Dec 23, 2022

@juanjoseruiz I had this running overnight and 0 crashes. So I suspect this should fix your issue

1reaction
bizob2828commented, Dec 22, 2022

@juanjoseruiz the fix I’m describing hasn’t been released yet. It will be out in 9.7.5 but I plan on starting there to see if a fix exists

Read more comments on GitHub >

github_iconTop Results From Across the Web

FATAL ERROR: v8::FromJust Maybe value is Nothing #6899
The command that caused this was vitest run which is running my tests. FATAL ERROR: v8::FromJust Maybe value is Nothing. 1: 00007FF6422194EF ...
Read more >
Error when building angular with nx FATAL ERROR: v8
sometimes I got the following error when building a angular app with nx on the build server. FATAL ERROR: v8::FromJust Maybe value is...
Read more >
FATAL ERROR: v8::FromJust Maybe value is Nothing. #2947
Description. I'm currently migrating a test suite with ~100 tests from Mocha to AVA. Writing those tests is a breeze, but unfortunately the...
Read more >
FATAL ERROR: v8::FromJust Maybe value is Nothing
Version: 4.2.2, 4.4.0, 6.2.0; Platform: 4.2.0-35-generic #40-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux; Subsystem: ubuntu 15.10.
Read more >
src/api/api.cc - v8/v8 - Git at Google
FATAL("API fatal error handler returned after process out of memory"); ... Utils::ApiCheck(false, "v8::FromJust", "Maybe value is Nothing.");.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found