Repository navigation
Closed
Description
What happened:
I am receiving integer overflow errors in some large scale computations. Haven't had the chance to construct a MCVE but will try to.
cc @jakirkham I believe you reworked this section recently. Maybe you spot what's going wrong right away
What you expected to happen:
Minimal Complete Verifiable Example:
N/A
Anything else we need to know?:
Traceback (most recent call last):
File "/mnt/mesos/sandbox/venv/lib/python3.6/site-packages/distributed/core.py", line 554, in handle_stream
msgs = await comm.read()
File "/mnt/mesos/sandbox/venv/lib/python3.6/site-packages/distributed/comm/tcp.py", line 199, in read
n = await stream.read_into(frames)
File "/mnt/mesos/sandbox/venv/lib/python3.6/site-packages/tornado/iostream.py", line 475, in read_into
self._try_inline_read()
File "/mnt/mesos/sandbox/venv/lib/python3.6/site-packages/tornado/iostream.py", line 842, in _try_inline_read
pos = self._read_to_buffer_loop()
File "/mnt/mesos/sandbox/venv/lib/python3.6/site-packages/tornado/iostream.py", line 755, in _read_to_buffer_loop
if self._read_to_buffer() == 0:
File "/mnt/mesos/sandbox/venv/lib/python3.6/site-packages/tornado/iostream.py", line 867, in _read_to_buffer
bytes_read = self.read_from_fd(buf)
File "/mnt/mesos/sandbox/venv/lib/python3.6/site-packages/tornado/iostream.py", line 1592, in read_from_fd
return self.socket.recv_into(buf, len(buf))
File "/usr/lib/python3.6/ssl.py", line 1009, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.6/ssl.py", line 871, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.6/ssl.py", line 631, in read
v = self._sslobj.read(len, buffer)
OverflowError: signed integer is greater than maximum (distributed.core)Environment:
- Dask version: dask/dask@91cee5b
- tornado version: 6.1
- Python version: py3.6
- Operating System: Deb9
- Install method (conda, pip, source): pip
Metadata
Metadata
Assignees
Labels
No labels
Activity
fjetter commentedon Feb 23, 2021
might've been introduced by #4506
jakirkham commentedon Feb 23, 2021
Have we confirmed it is due to that change? Does the previous commit work?
fjetter commentedon Feb 23, 2021
I reverted the commit and didn't run into the issue anymore but I'm also not sure if my computation triggers this reliably.
jakirkham commentedon Feb 23, 2021
Ok thanks for that data point
It might be worth sticking a
print(frames_nbytes)inreadto see how large the message is when things failjakirkham commentedon Feb 23, 2021
Does this show up in other Python versions?
jakirkham commentedon Feb 23, 2021
Asking about other Python versions as 3.6 is the only one with SSLObject. It got removed with PR ( python/cpython#5252 ) in 3.8, which was also backported to 3.7. So would be good to know if this is just an oddity of 3.6
jakirkham commentedon Feb 24, 2021
Just checking in here. @fjetter do you have insight into this question?
fjetter commentedon Feb 25, 2021
As of now, I don't have any more insights. I will try to set up another test run today to see if I can reproduce it another time. I will also try another python version. Since this requires a bit of time on my end, is there anything else worth checking out in these test runs?
anything else worthy logging/inspecting?
fjetter commentedon Feb 25, 2021
So far, I was not able to reproduce :/
jakirkham commentedon Feb 25, 2021
Interesting. What things have been tried thus far?
Yeah those are the main things I can think of. Are there other things that you think would be relevant to test?
jrbourbeau commentedon Mar 3, 2021
Just checking in here, @fjetter any luck on reproducing? I don't mean to apply unneeded pressure, but I'm wondering if this is a blocker for our upcoming release (xref dask/community#129)
fjetter commentedon Mar 4, 2021
I'm not actively working on this due to limited time and my last efforts reproducing it was not successful. Considering that the exception is caused by a SSLObject which only exists in py3.6, I'm wondering if it is a reasonable assumption that this will only be an issue on py36?
My gut feeling tells me that a very difficult to reproduce, yet to be confirmed issue which likely only triggers on a python version we're about to drop should not block a release.
jakirkham commentedon Mar 18, 2021
Should we go ahead and close now that Python 3.6 is dropped?
jrbourbeau commentedon Mar 18, 2021
Yeah, let's close for now and re-open is needed
2 remaining items
jakirkham commentedon May 21, 2021
Do you have a reproducer? If so, can you please share this in a new issue?
RichardScottOZ commentedon May 21, 2021
Not easy to reproduce in that is large scale satellite data processing via Open Data Cube on a Dask Gateway Kubernetes cluster, but can give some details.
quasiben commentedon May 21, 2021
It looks like this is also happening in Python >= 3.8:
https://bugs.python.org/issue42853
jakirkham commentedon Jun 2, 2021
At the end of that Python issue Christian notes this is fixed in Python 3.10. PR ( python/cpython#25468 ) seems to be the relevant change.
Also he notes that this due to limitations of OpenSSL 1.0.2 and so remains an issue where that OpenSSL version is used. This is not an issue when OpenSSL 1.1.1 is used with the patch noted above
Edit: Asked on the issue whether it would be possible to backport the fix (note this would still require package builders to use the newer OpenSSL)
RichardScottOZ commentedon Jun 2, 2021
Seems to happen on the bigger/longer workloads I was doing- haven't seen it on small ones as yet.
jakirkham commentedon Jun 3, 2021
Yeah suspect that it is likely reproducible with a large message if that CPython bug is relevant. If not, maybe we are missing something
jakirkham commentedon Jul 24, 2021
Thinking about this a bit more, one option would be to take smaller views of the buffer we are reading into and fill those. We can ensure these buffers are big enough for OpenSSL to handle, but no bigger. After looking at the CPython code and OpenSSL, this appears to be the maximum value of a C
int, which will be implementation dependent. Have written some code in PR ( #5115 ), which should workaround this issue in this way. If anyone can reproduce, would be good to have some feedback on whether that works.mrocklin commentedon Jul 26, 2021
Should we be adjusting our maximum shard size in comms under certain conditions? We already reduce this for different systems. For example in websockets we restrict things today to 8MiB frames. Maybe we should do the same for TLS under certain versions
jakirkham commentedon Jul 26, 2021
It's possible we will want to change the frame size if we discover this batching of smaller amounts of data through OpenSSL is causing us performance issues. That said, I haven't dived into that side of things.
On a different note, it's interesting that OpenSSL uses an
inthere at all instead ofsize_t, which is what OpenSSL 1.1.1+ does and is what one would use in C typically. Maybe this code is quite old and precedessize_tor they would have been nearly equivalent at the time? Or no one thought so much data would be given to OpenSSL? Or perhaps whatever algorithm was used couldn't handlesize_tamounts of data previously?jakirkham commentedon Jul 28, 2021
As this error could show up in the
writecode path as well, added PR ( #5134 ) to protect against that too.Edit: Superseded by PR ( #5141 )
Cap maximum shard size at the size of an integer
Cap maximum shard size at the size of an integer (#5141)
jakirkham commentedon Jul 30, 2021
We are cutting a release tomorrow. These fixes should be in there ( dask/community#173 )