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

We have this job set up that normally works without problems. Every 10 minutes it checks whether any rules are expired and removes the expired ones.

However, seemingly randomly every 1-2 days, the job exits with the following error:

FATAL ERROR: v8::FromJust Maybe value is Nothing.
[2021-09-07T08:30:36.060Z] [error]: Worker for job "delete-expired" had an error
 1: 0xa24ed0 node::Abort() [node]
 2: 0x966115 node::FatalError(char const*, char const*) [node]
 3: 0xb9a9fa v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: 0xa286ed node::fs::FileHandle::CloseReq::Resolve() [node]
 5: 0xa28849  [node]
 6: 0x139ca5d  [node]
 7: 0x13a10b6  [node]
 8: 0x13b3e45  [node]
 9: 0x13a19e8 uv_run [node]
10: 0xadd343 node::worker::Worker::Run() [node]
11: 0xadddd8  [node]
12: 0x7fc31a7cf609  [/lib/x86_64-linux-gnu/libpthread.so.0]
13: 0x7fc31a6f6293 clone [/lib/x86_64-linux-gnu/libc.so.6]
Aborted (core dumped)

I have no idea how to go into debugging this but I assume it is an issue with the bree package core files.

The worker itself:

import { knex } from '../app/utils/connection.js';
import { parentPort } from 'worker_threads';
import { CalculatedPrice as CalculatedPriceModel } from '../app/models/index.js';
import { Cache, CalculatedPrice } from '../app/controllers/index.js'
import { getDate } from '../app/utils/date.js';

(async () => {
    // select all data that expired
    const expiredPrices = await knex('calculated_price').select('contact_id', 'sku').where('ending_date', '<', getDate()).then();
    parentPort.postMessage(JSON.stringify(expiredPrices));

    if (expiredPrices.length !== 0) {
        const expiredKeys = [];
        for (let i=0; i<expiredPrices.length; i++) {
            const { contact_id, sku } = expiredPrices[i]
            expiredKeys.push(`${contact_id}_${sku}`);
        }

        const uniqueExpiredKeys = Array.from(new Set(expiredKeys));
        // delete all that data from calculated_price
        const recalculatePairs = uniqueExpiredKeys.map((key) => key.split('_'));
        parentPort.postMessage(recalculatePairs);
        await knex('calculated_price').whereIn(['contact_id', 'sku'], recalculatePairs).del();
        parentPort.postMessage('Deleted data from calculated_price')

        // recalculate
        const calculationPromises = [];
        for (let i=0; i<expiredPrices.length; i++) {
            const { contact_id, sku } = expiredPrices[i];
            calculationPromises.push(CalculatedPrice.calculatePriceUsingSku(contact_id, sku));
        }
        await Promise.all(calculationPromises);
        parentPort.postMessage('Recalculated')
        // delete from cache or just rewrite
        parentPort.postMessage(expiredKeys);
        await Cache.deleteCachedCalculatedRules(expiredKeys);
        parentPort.postMessage('Deleted from cache')
        // add in cache
        await Cache.setCalculatedPricesInCache(recalculatePairs);
        parentPort.postMessage('Added to cache')
    }

    process.exit(0);
})();

Any help how this could be debugged?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
shadowgate15commented, Sep 22, 2021

@climba03003 Let us know if it works so we can have that documented here.

1reaction
climba03003commented, Sep 21, 2021

Just an idea, when I connect mongodb inside a worker but not closing the connection properly before exit. It will throw me a core error about stream.

I assume knex using sqlite will result the same if not properly closing the fs stream?

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