Azure Web App: connection reset on HTTPS request with a file associated

Adrien Michaud 21 Reputation points
2021-09-01T08:17:43.54+00:00

Hello,

I've been strugling with one big issue on my Azure Web App.

I need to send an client certificate authenticated request with some small files (less than 1mb). But at a certain point of requet size, I always get a connection reset error.

I've tried two ways to test this: the python libraries requests/aiohttp. I'm also trying to find logs but my application on Azure (Nginx) did not receive anything.

I suspect the client certificate authentication to be the problem since when I remove client authentication, the problem dissapear... But I need it.

Here the error I have with AioHttp:

File ".\libs\server\gateway_mock.py", line 105, in send_instruction_reponse
status_code, body = await post(
File ".\libs\common\requesting\fct_requesting_aio.py", line 57, in post
async with client.post(
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\aiohttp\client.py", line 1117, in aenter
self._resp = await self._coro
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\aiohttp\client.py", line 544, in _request
await resp.start(conn)
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\aiohttp\client_reqrep.py", line 890, in start
message, payload = await self._protocol.read() # type: ignore
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\aiohttp\streams.py", line 604, in read
await self._waiter
aiohttp.client_exceptions.ClientOSError: [WinError 64] The specified network name is no longer available

Here the error with request:

File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\http\client.py", line 1347, in getresponse
response.begin()
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\http\client.py", line 307, in begin
version, status, reason = self._read_status()
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\http\client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] Une connexion existante a d� �tre ferm�e par l�h�te distant

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\util\retry.py", line 532, in increment
raise six.reraise(type(error), error, _stacktrace)
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\packages\six.py", line 769, in reraise
raise value.with_traceback(tb)
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "c:\users\arh.virtualenvs\testsmhs-5ui_sodk\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\http\client.py", line 1347, in getresponse
response.begin()
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\http\client.py", line 307, in begin
version, status, reason = self._read_status()
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\http\client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "C:\Users\Arh\AppData\Local\Programs\Python\Python38\Lib\ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'Une connexion existante a d� �tre ferm�e par l�h�te distant', None, 10054, None))

But, worth mentionning, using Curl or Postman makes it work, so I have no clue about the error.

Do you know any way to debug further into Azure ? I need more than the web app logs because my Nginx doesn't receive the request.

Thanks for your help !

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,909 questions
{count} votes