http icon indicating copy to clipboard operation
http copied to clipboard

SocketException after long time POST

Open plake876 opened this issue 5 years ago • 13 comments

If i make a long time post with MultipartRequest class i get a SocketException after 70 seconds Setting timeouts have no effect.

Exception: SocketException: OS Error: Software caused connection abort, errno = 103, address = 192.168.1.1, port = 54136

Codesnippet:

final Uri url = ......
MultipartRequest request = new MultipartRequest("POST", url);
Uint8List data = .......

Map<String, String> headers = {
	"Content-Type": "multipart/form-data",
   "Expect": "100-continue",
   "Accept": "*/*"
};

final MultipartFile multipartFile =  MultipartFile.fromBytes("firmware", data);
request.headers.addAll(headers);
request.files.add(multipartFile);
   
try {
  return await request.send();
} catch (error) {
  print(error.toString());
}

The POST with curl is successful.

$ curl -v -F filenmae=@filexyz http://192.168.1.1/upload.cgi
*   Trying 192.168.1.1...
* TCP_NODELAY set
* Connected to 192.168.1.1 (192.168.1.1) port 80 (#0)
> POST /upload.cgi HTTP/1.1
> Host: 192.168.1.1
> User-Agent: curl/7.61.1
> Accept: */*
> Content-Length: 7602006
> Content-Type: multipart/form-data; boundary=------------------------db58954d11f68cd8
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< Server: xyz/0.0.8
< Content-Length: 0
< Connection: keep-alive
* Done waiting for 100-continue
< HTTP/1.1 102 Processing
< Server: xyz/0.0.8
< Content-Length: 0
< Connection: keep-alive
< HTTP/1.1 201 Created
< Server: xyz/0.0.8
< Content-Length: 0
< Connection: close
* Closing connection 0

plake876 avatar Mar 22 '19 14:03 plake876

We have the same issue when sending a simple post request that contains a JSON (no multipart like in the issue above) Is there any documentation on the error codes? In this case 103.

JulianBissekkou avatar Oct 18 '19 19:10 JulianBissekkou

Same here

Alexddsilva avatar Sep 08 '20 18:09 Alexddsilva

I get the same exception in my flutter app (SocketException: OS Error: Software caused connection abort, errno = 103). I have an app with a long-lasting websocket connection. When the app was in the background for a long time (>>60min), I can't get any network connection going once the app is resumd. Neither the mentioned websocket connection, nor a new websocket connection, nor a simple http GET to google.com. The app-integrated Sentry-SDK can make network calls though (logging the mentioned exception). Any ideas or workarounds?

Happens on iOS 13, Android 9 and 10 and Windows. Tested with stable, dev and master channels.

strohmann avatar Sep 12 '20 18:09 strohmann

@strohmann Did you ever get this working? Sounds like an ugly bug.

formvoltron avatar Jun 06 '21 02:06 formvoltron

I have the same but with only difference taht websockets are disconnected i get 104 error but i can make any other requests. Do you have an idea how to workaround? Maybe i have to write reconnect logic.

vytautas-pranskunas- avatar Jun 12 '21 14:06 vytautas-pranskunas-

Same issue!

deremakif avatar Aug 27 '21 09:08 deremakif

Same issue!!!

LuodiJackShen avatar Jan 12 '22 11:01 LuodiJackShen

Same issue!

scherermathias avatar Aug 24 '22 12:08 scherermathias

same issue !

thorizer avatar Aug 26 '22 12:08 thorizer

Same issue!

spanero avatar Sep 08 '22 06:09 spanero

Same issue!

Heatclift avatar Oct 10 '22 07:10 Heatclift

Has anyone had any more insight on this issue? I have many users dealing with it when uploading videos, but I am not able to reproduce it.

caleb654 avatar Nov 07 '22 18:11 caleb654

Same issue!

yuangu avatar Dec 12 '23 15:12 yuangu