stencila / py

Stencila for Python
Apache License 2.0
17 stars 1 forks source link

OverflowError on Windows when running `stencila.run()` #14

Closed cuibonobo closed 6 years ago

cuibonobo commented 6 years ago

Python 3.6 running on Windows 10. Running "C:\Program Files\Python36\python.exe" -c "import stencila; stencila.run(echo=True)" produces the following stack trace:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jgarcia\AppData\Roaming\Python\Python36\site-packages\stencila\__init__.py", line 35, in run
    host.run(*args, **kwargs)
  File "C:\Users\jgarcia\AppData\Roaming\Python\Python36\site-packages\stencila\host.py", line 285, in run
    time.sleep(0x7FFFFFFF)
OverflowError: sleep length is too large

Indeed, changing the argument of time.sleep() to 0x7FFFF (chosen arbitrarily -- I deleted Fs one-by-one until it worked) allows run() method to run as expected.

I'm very confused by this because the Python 3 docs only mention OverflowError in the context of an integer overflow, which should be 232. Instead, the limit here seems to be 220.

cuibonobo commented 6 years ago

Just tested this on macOS 10.12.6 and Python 3.6 and got a similar error for the same line.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/jgarcia/Library/Python/3.6/lib/python/site-packages/stencila/__init__.py", line 35, in run
    host.run(*args, **kwargs)
  File "/Users/jgarcia/Library/Python/3.6/lib/python/site-packages/stencila/host.py", line 285, in run
    time.sleep(0x7FFFFFFF)
OSError: [Errno 22] Invalid argument

For this OS, the upper limit seems to be 224.

nokome commented 6 years ago

Thanks for this :bug: report, very useful. I've changed the value to 1000. Since this is in a while loop, the value can be arbitrarily high - just enough to not cause too much CPU load.