Skip to content

asyncio/stream: Catch and ignore ECONNRESET. #13478

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

Closed

Conversation

ned-pcs
Copy link
Contributor

@ned-pcs ned-pcs commented Jan 19, 2024

This commit deals with ECONNRESET (and EPIPE) exceptions while reading from sockets.
For more context, see micropython/micropython-lib#788

Copy link

github-actions bot commented Jan 19, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:  +152 +0.019% standard[incl +32(data)]
      stm32:  +132 +0.034% PYBV10
     mimxrt:  +136 +0.037% TEENSY40
        rp2:  +128 +0.039% RPI_PICO
       samd:  +140 +0.053% ADAFRUIT_ITSYBITSY_M4_EXPRESS

@ned-pcs ned-pcs marked this pull request as draft January 19, 2024 21:47
@ned-pcs
Copy link
Contributor Author

ned-pcs commented Jan 19, 2024

I see that the Unix tests that expected to see the ECONNRESET exception have failed.
Without this commit, my ESP32 client reading from a Unix micropython server would get ECONNRESET errors, though a Unix client didn't.

@Carglglz
Copy link
Contributor

@ned-pcs this makes the those tests pass

...
 except OSError as exc:
    if exc.errno in (ECONNRESET, EPIPE) and r:
        return r
    raise

Could this work in ESP32? 👀

@dpgeorge
Copy link
Member

Can you please provide a minimal Python example that shows the problem you are encountering?

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Jan 22, 2024
@ned-pcs
Copy link
Contributor Author

ned-pcs commented Jan 22, 2024

@Carglglz I tried the logic you showed ( if exc.errno in (ECONNRESET, EPIPE) and r:) but that didn't eliminate the problem on the ESP32 side.
@dpgeorge My current test program uses Microdot as a server; I will write a simplified version that doesn't use Microdot when I get some time.

This commit deals with ECONNRESET exceptions while reading from sockets.

Signed-off-by: Ned Konz <ned@productcreationstudio.com>
Signed-off-by: Ned Konz <ned@productcreationstudio.com>
@ned-pcs ned-pcs force-pushed the ned-pcs/asyncio-econnreset-fix branch from 531c5d3 to d9e2f48 Compare January 25, 2024 19:14
@Carglglz
Copy link
Contributor

@ned-pcs I think this can be closed, see #13533 for a possible fix.

@ned-pcs
Copy link
Contributor Author

ned-pcs commented Jan 30, 2024

@Carglglz I have tested your #13533 fix and it works. Closing.

@ned-pcs ned-pcs closed this Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy