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

OverflowError #35

Open
tedder opened this issue Jul 14, 2024 · 7 comments
Open

OverflowError #35

tedder opened this issue Jul 14, 2024 · 7 comments

Comments

@tedder
Copy link
Contributor

tedder commented Jul 14, 2024

After less than 24hrs, datetime() seems to fail right now. I haven't debugged what's causing it, though it seems to be from self._monotonic_start.

  File "adafruit_ntp.py", line 97, in datetime
OverflowError: overflow converting long int to machine word

Here's a link to the current version of the file:

self._monotonic_start = (

@tannewt
Copy link
Member

tannewt commented Jul 15, 2024

What board are you running this on? A few small ones don't have long int support (where ints are allocated to the heap.)

@tedder
Copy link
Contributor Author

tedder commented Jul 15, 2024

It's the qtpy esp32 s2 running 9.x:

Adafruit CircuitPython 9.0.4 on 2024-04-16; Adafruit QT Py ESP32S2 with ESP32S2
Board ID:adafruit_qtpy_esp32s2
UID:[..]

@tedder
Copy link
Contributor Author

tedder commented Jul 15, 2024

Not sure if it's helpful, but:

>>> g=2147483640
>>> print(g)
2147483640
>>> g+=90000
>>> print(g)
2147573640
>>> print(type(g))
<class 'int'>

Also confused why it works some of the time. seconds is the only value that changes in that _monotonic_start equation, I'd think.

@tannewt
Copy link
Member

tannewt commented Jul 16, 2024

Try printing seconds. I wonder if the struct unpack is causing the issue.

@tedder
Copy link
Contributor Author

tedder commented Jul 16, 2024

since the failure is intermittent, I'm not sure if/when I'll be able to catch it. For now, here's the type and value:

<class 'int'> 3930136863

@tedder
Copy link
Contributor Author

tedder commented Jul 16, 2024

ooo, I got one.

<class 'int'> 3930141298
<class 'int'> 0
OverflowError: overflow converting long int to machine word

Note that's two calls, the second one failed.

tedder added a commit to tedder/Adafruit_CircuitPython_NTP that referenced this issue Jul 16, 2024
Test to ensure response value is valid. Intermittent seconds=0 value have been seen.

fixes adafruit#35
@tedder
Copy link
Contributor Author

tedder commented Jul 16, 2024

sending two PRs.

#37 prevents the socket call from happening every few seconds, which reduces the chances of failure.
#38 does a sanity check to ensure the value is valid. it means a new error needs to be caught.

It's possible there's a better fix to the root cause, but these turn it into a known problem, at least.

tedder added a commit to tedder/Adafruit_CircuitPython_NTP that referenced this issue Jul 23, 2024
Test to ensure response value is valid. Intermittent seconds=0 value have been seen.

fixes adafruit#35
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

Successfully merging a pull request may close this issue.

2 participants