Skip to content

Certain Feather RP2040 (ESP32SPI) chunked responses fail #75

@anecdata

Description

@anecdata

This one only manifests on Feather RP2040. It doesn't happen on PyPortal or FeatherS2. Some primitive behaves different? A timing quirk? Flash issue? Other??

This URL comes back as a chunked response, but loads fine:
https://anecdata.dev/ada/chunked2/?oc=8&ic=4&tr=28&ot=0&it=0

But this one hangs up on receiving:
https://anecdata.dev/ada/chunked2/?oc=7&ic=3&tr=17&ot=0&it=0

The parameters affect the data size. My only intuition is that round numbers seem to be fine, but less-round (odd?) numbers fail. The failures manifest as hanging on receive in line 122 of Requests:

Fetching text from https://anecdata.dev/ada/chunked2/?oc=7&ic=3&tr=17&ot=0&it=0
----------------------------------------
Traceback (most recent call last):
  File "code.py", line 34, in <module>
  File "adafruit_requests.py", line 326, in text
  File "adafruit_requests.py", line 315, in content
  File "adafruit_requests.py", line 369, in iter_content
  File "adafruit_requests.py", line 257, in close
  File "adafruit_requests.py", line 245, in _throw_away
  File "adafruit_requests.py", line 122, in _recv_into
  File "adafruit_esp32spi/adafruit_esp32spi_socket.py", line 132, in recv
  File "adafruit_esp32spi/adafruit_esp32spi_socket.py", line 172, in available
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 731, in socket_available
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 325, in _send_command_get_response
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 281, in _wait_response_cmd
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 188, in _wait_for_ready
KeyboardInterrupt: 

(^c after a minute of waiting)

or in reading the chunks, as in:

Traceback (most recent call last):
  File "code.py", line 32, in <module>
  File "adafruit_requests.py", line 326, in text
  File "adafruit_requests.py", line 315, in content
  File "adafruit_requests.py", line 361, in iter_content
  File "adafruit_requests.py", line 220, in _readinto
ValueError: invalid syntax for integer with base 16

In my 'prodution' code, it's always the latter situation. I haven't been able to run Feather RP2040 + Airlift from the beginning.

I doubt it's an Apache issue since it returns fine in the browser and with curl --http1.1. Old Requests was HTTP/1.0, chunked responses are a fact of life with HTTP/1.1.

I've tried this on various versions since the board became available, most recently with Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit Feather RP2040 with rp2040 and Adafruit CircuitPython 6.2.0-beta.3-142-ga5c675932 on 2021-03-12; Adafruit Feather RP2040 with rp2040 (the slower flash version from adafruit/circuitpython#4392 )

I've spend a lot of time print-debugging this and I'm baffled. By the way, this Feather (I only have one) still has the disappearing-on-reset issue, even with the slower flash version UF2. But large file copies that were a problem before are no longer a problem in the slower flash version or in beta.4. So this could be some weird flash issue, though I've seen no other issues since the slower flash commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions