Comments (13)
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.
And the latest async log now prints this error instead: Offset undefined is not a number
from async-append-only-log.
@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.
Will have a look
from async-append-only-log.
@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.
Aha that migrate check doesn't work:
offset = NaN
console.log(typeof offset !== 'number' || offset < 0)
=> false
from async-append-only-log.
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.
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.
@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.
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.
I'll check if there's more logs in those crash reports
from async-append-only-log.
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.
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)
- setimmediate vs nexttick HOT 1
- offset is out of range HOT 9
- Cannot read property 'slice' of undefined HOT 1
- More pausing stream bugs
- Make multiprocess-safe HOT 5
- RangeError [ERR_OUT_OF_RANGE] HOT 11
- Sparse file HOT 12
- Add cache flag to stream
- Compaction HOT 8
- Improve hole detection performance HOT 2
- Improve performance of isBufferZero HOT 2
- Make starting up a new log less noise HOT 1
- Compaction state written even if not used HOT 1
- Crash writeWithFSync on a null block HOT 1
- RangeError when reading record data length
- NaN RangeError when deleting records HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async-append-only-log.