Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of range error #24

Closed
Zagreus9723 opened this issue Sep 5, 2023 · 5 comments
Closed

Out of range error #24

Zagreus9723 opened this issue Sep 5, 2023 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Zagreus9723
Copy link

-------- Results : Room 3 --------
--------ROUND RESULT-----------
internal/buffer.js:82
throw new ERR_OUT_OF_RANGE(type || 'offset',
^
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 8305. Received 7_480_365_372
at boundsError (internal/buffer.js:82:9)
at Buffer.readUInt32LE (internal/buffer.js:216:5)
at Object.evalCard (/home/ubuntu/poker-pocket-backend/src/app/evaluator.js:111:23)
at Object.eval (/home/ubuntu/poker-pocket-backend/src/app/evaluator.js:95:16)
at Object.evalHand (/home/ubuntu/poker-pocket-backend/src/app/evaluator.js:89:17)
at Room.evaluatePlayerCards (/home/ubuntu/poker-pocket-backend/src/app/room.js:1194:26)
at Room.roundResultsEnd (/home/ubuntu/poker-pocket-backend/src/app/room.js:467:28)
at Room.staging (/home/ubuntu/poker-pocket-backend/src/app/room.js:301:12)
at Timeout._onTimeout (/home/ubuntu/poker-pocket-backend/src/app/room.js:444:11)
at listOnTimeout (internal/timers.js:554:17) {
code: 'ERR_OUT_OF_RANGE'
}
[nodemon] app crashed - waiting for file changes before starting...


This happens after sending all cards to all players

@norkator norkator added bug Something isn't working good first issue Good for newcomers labels Sep 6, 2023
@norkator
Copy link
Owner

norkator commented Sep 6, 2023

I have not seen this issue but could you provide details of your config you used to set up rooms?

@shrpne
Copy link
Contributor

shrpne commented Sep 7, 2023

I experienced this issue few times after building docker image in my production server.
The issue was caused by HandRanks.dat having short length (around 400 in my case, in @Zagreus9723 it is 8305).
I don't understand why this file can be such short length, logs of docker build was shown that the file was downloaded completely.
Rebuilding docker image few times helps me fix this

@shrpne
Copy link
Contributor

shrpne commented Sep 7, 2023

BTW i've implemented simple healthcheck, that makes app fail earlier in case of invalid HandRanks.dat file

const healthCheckRanksLength = require('./src/app/evaluator.js').ranks.length;
const healthCheckValidLength = 129951336;

if (healthCheckRanksLength !== healthCheckValidLength) {
 throw someError
}

@Zagreus9723
Copy link
Author

Thanks. I can test this now and see if redownloading works.

@Zagreus9723
Copy link
Author

How strange. Looks like that was the issue. I had to scp the file from my main machine to my server, server was truncating the file ~8k lines every time for some reason. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants