Skip to content

Device hangs when client disconnects while file upload #8618

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

Open
3 of 6 tasks
PaSaSaP opened this issue Jun 25, 2022 · 3 comments
Open
3 of 6 tasks

Device hangs when client disconnects while file upload #8618

PaSaSaP opened this issue Jun 25, 2022 · 3 comments

Comments

@PaSaSaP
Copy link

PaSaSaP commented Jun 25, 2022

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: Wemos D1 Mini PRO (ESP8266)
  • Core Version: 3.0.2 (official release), Jul 27, 2021
  • Development Env: Arduino IDE
  • Operating System: MacOS

Settings in IDE

  • Module: LOLIN (WEMOS) D1 mini pro (esp8266)
  • Flash Mode: -
  • Flash Size: 16MB (FS: 14MB, OTA:~1019KB)
  • lwip Variant: v2 Higher Bandwidth
  • Reset Method: -
  • Flash Frequency: -
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 3000000

Problem Description

I have checked it on Wemos D1 mini pro and on ESP-01 (default setting + debug messages) and behavior is the same.

Listening socket is not closed when client uploads file to HTTP Server and while uploading client disconnects from WiFi.

To reproduce it on PC with WiFi:

Device need to be restarted manually to "fix" it by hand.
To fix it for now for myself I have introduced timeout (the simplest solution?): master...PaSaSaP:uploadReadByte-timeout but I think that client should be disconnected in similar way just like when socket is closed on client side (which works).

I will try to reproduce it in latest git revision.

MCVE Sketch

Simple sketch available at: https://github.com/PaSaSaP/ESP8266_upload_file_issue

Debug Messages

All serial output with enabled all debug messages available at: https://github.com/PaSaSaP/ESP8266_upload_file_issue/blob/master/serial-output.log

@d-a-v
Copy link
Collaborator

d-a-v commented Jun 25, 2022

It might be interesting to retest after #8607 is merged.

@PaSaSaP
Copy link
Author

PaSaSaP commented Jun 25, 2022

Tested with latest git revision and still can be reproduced.
Tested with #8607 on 3.0.2 and latest git and problem still exists.

@mcspr
Copy link
Collaborator

mcspr commented Jun 26, 2022

I think the issue here is with the abrupt disconnection of a client while upload is still in progress? If I remember values correctly, we end up with 'disconnected' TCP state only after ~10-15 minutes.

edit: I suppose uploadReadByte timeout works, just need to double-check we are waiting for the specific piece and not the overall upload so it ends up timing out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants