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

Crashing randomly (nim 1.6.14) #9

Closed
nbaertsch opened this issue Sep 26, 2023 · 3 comments
Closed

Crashing randomly (nim 1.6.14) #9

nbaertsch opened this issue Sep 26, 2023 · 3 comments

Comments

@nbaertsch
Copy link

Sometimes getting a RangeDefect exception raised in progress= with stack trace:

C:\Users\ABC123\.nimble\pkgs\suru-0.3.1\suru.nim(131) inc
C:\Users\ABC123\.nimble\pkgs\suru-0.3.1\suru.nim(73) inc
C:\Users\ABC123\.nimble\pkgs\suru-0.3.1\suru.nim(54) progress=
C:\Users\ABC123\.choosenim\toolchains\nim-1.6.14\lib\system\fatal.nim(54) sysFatal
Error: unhandled exception: value out of range: 3551325900 notin -2147483648 .. 2147483647 [RangeDefect]

I'm not overly familiar with this codebase so I will not suggest any change but this should be an easy fix (maybe?) if I understand the issue right.

@nbaertsch
Copy link
Author

nbaertsch commented Sep 26, 2023

line 54: ssb.timeStat.push (newTime.ticks - ssb.lastChange.ticks).int

assigning an int64 to a float64 is the cause and I think it maybe could be fixed just simply by
ssb.timeStat.push (newTime.ticks - ssb.lastChange.ticks).float

@de-odex
Copy link
Owner

de-odex commented Oct 2, 2023

I am not too sure. line 34

proc push(mv: var ExpMovingAverager, value: SomeNumber) =
  let value = value.float

should catch that as well.

@nbaertsch
Copy link
Author

still running into this issue, now on nim 2.0.0. Is it perhaps to do with using the same name for push(... , value: SomeNumber) and let value = value.float? I am not sure nim handles this name conflict. Confirmed that my change above fixes the issue but a preferred fix would be in the push function`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants