Code Monkey home page Code Monkey logo

Comments (13)

arj03 avatar arj03 commented on May 18, 2024 1

Hello there old friend :-)

arj@arj:~/dev/jitdb$ rm indexes/seq.index 
arj@arj:~/dev/jitdb$ touch indexes/seq.index
arj@arj:~/dev/jitdb$ node example.js asynclog.bipf
internal/buffer.js:75
    throw new ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value);
    ^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be an integer. Received NaN

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024 1

And the latest async log now prints this error instead: Offset undefined is not a number

from async-append-only-log.

staltz avatar staltz commented on May 18, 2024

@arj03 If you'd like to see exactly what those lines of code were, here's the 2.4MB index.js that matches what those users are using in production: index.zip

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024

Will have a look

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024

@staltz so I'm looking at the error and it appears that something it sending down a NaN offset. This crashes the read. We should probably handle that in a nicer way.

I went looking in ssb-db2 to see if I could find something that could trigger this. I saw that you seem to have guarded against that in migrate.js. So I'm guessing you have seen a problem when newLog.since.value is NaN?

Maybe one way to handle this better is to at least send up an error in get, then we should have a better time localizing the error. And in general that seems like the right thing to do.

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024

Aha that migrate check doesn't work:

offset = NaN
console.log(typeof offset !== 'number' || offset < 0)
=> false

from async-append-only-log.

staltz avatar staltz commented on May 18, 2024

You know what? When I wrote that check in migrate, I actually thought that a NaN could sneak in because the typeof doesn't cover it, but I dismissed the thought because "how could this possibly be a NaN?" Like, you need to divide by zero or something. And it should come from the since.value, which I have a hard time believing it could be NaN.

Sigh. Still don't know why the NaN happens but we can add a check for it anyways.

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024

The migrate hunch was probably not correct. It's really annoying that random access file seems to use a queue that destroys the backtraces. With the updated async log it should at least not die there, instead the error should bubble up. Maybe a more likely case would be if you add undefined to a number, you also end up with NaN. Without any more stacktrace to go by its like looking for a needle in a haystack.

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024

@staltz Question, do these backtraces include the debug() calls?

I still can't get this out of my head. There are actually not that many calls to get. Especially ones where there is a fs call right in front of it. The since is such a case, but I can't seem to see where since would end up being NaN. In this line if any of those 3 are undefined since will be NaN. Doesn't seem like it could be len because then the read would have failed, blockSize should be constant so no and if it was recordOffset then the readUint16LE right below it should fail before get has a chance to fail.

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024

There is actually this old issue where you had this problem with jitdb. This was even with flumelog-aligned-offset. Still the same kind of error.

from async-append-only-log.

staltz avatar staltz commented on May 18, 2024

I'll check if there's more logs in those crash reports

from async-append-only-log.

arj03 avatar arj03 commented on May 18, 2024

I think I know what it might be now. In jitdb if the offset index is not saved properly but the other indexes are, then the lookup in offset will return undefined. Will try to reproduce.

from async-append-only-log.

staltz avatar staltz commented on May 18, 2024

Great! I anyway couldn't find anything in the crash report logs, only Java-specific stuff (users would have to manually enable debug() for us to get those in the logcat).

from async-append-only-log.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.