Looking at two venvs built with each of the two python3-pip-whl
packages, it seems like there are a couple changes, but one thing that
jumps out is a new max_length param added to the embedded urllib3 in
several places, though it seems to only actually be activated in one
place (urllib3.response.HTTPResponse.read):

             data = self._fp_read(amt) if not fp_closed else b""
⋮
-            data = self._decode(data, decode_content, flush_decoder)
+            data = self._decode(
+                data, decode_content, flush_decoder,
+                max_length=(amt or 0),
+            )

If I change max_length=(amt or 0) to max_length=0, pip install -U pip
works as expected.

If I add in a few more prints, it looks like what's happening is that
it's asking the TLS layer for 10 KiB of data, then feeding that into the
zlib layer but limiting that to only 10 KiB too, leaving data behind
inside the decompressor. It then reads a second 10 KiB from TLS and
pushes it into zlib, but then only gets another 10 KiB of decompressed
data back out, leaving even more data in the decompressor. It then
repeats two more times until the entire compressed payload has been
extracted from the TLS layer, but only extracts one final 10 KiB chunk
from the decompressor and then stops — all future calls to read() return
b'' because the TLS layer returns b'' (the decompressor is never allowed
to finish draining):

$ pip install -U pip
Requirement already satisfied: pip in ./.venv/lib/python3.12/site-packages 
(24.0)
read(amt=None, decode_content=False, cache_content=False)
  fp_read(amt=None):
    read 0 bytes
  returning 0 bytes
read(amt=10240, decode_content=True, cache_content=False)
  fp_read(amt=10240):
    read 10240 bytes
  decode(data=[10240 bytes], decode_content=True, flush_decoder=False, 
max_length=10240):
    decoded 10240 bytes
  returning 10240 bytes
read(amt=10240, decode_content=True, cache_content=False)
  fp_read(amt=10240):
    read 10240 bytes
  decode(data=[10240 bytes], decode_content=True, flush_decoder=False, 
max_length=10240):
    decoded 10240 bytes
  returning 10240 bytes
read(amt=10240, decode_content=True, cache_content=False)
  fp_read(amt=10240):
    read 10240 bytes
  decode(data=[10240 bytes], decode_content=True, flush_decoder=False, 
max_length=10240):
    decoded 10240 bytes
  returning 10240 bytes
read(amt=10240, decode_content=True, cache_content=False)
  fp_read(amt=10240):
    read 6804 bytes
  decode(data=[6804 bytes], decode_content=True, flush_decoder=False, 
max_length=10240):
    decoded 10240 bytes
  returning 10240 bytes
read(amt=10240, decode_content=True, cache_content=False)
  fp_read(amt=10240):
    read 0 bytes
  returning 0 bytes
ERROR: Exception:
 ⋮


If I just dedent the data = self._decode(data, …) call (so it runs even if data 
== b''), it gets further, but still blows up without completing.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2154599

Title:
  pip install -U pip does not run

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/2154599/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to