Fatal error on ssl transport asyncio

I keep running into the bellow error and can't work out how to fix it or whether it is a bug in asyncio that I need to report. My program works fine is it basically the same as the example in there...

I keep running into the bellow error and can’t work out how to fix it or whether it is a bug in asyncio that I need to report. My program works fine is it basically the same as the example in there docs but it can send lots of messages upto 20 per second to multiple clients when there is a low number of updates it works fine but when the number of writes increases I run into this error.

I am using create_server from asyncio to make the server listen for new clients and I believe this creates a new connection on each connection. Not all clients stop only one clients stops and the rest keep running it’s usually the last client that connected but not always. I have played with the asyncio/sslproto.py file removing the reference to [0] and replacing them with popleft which they got me the not very helpful SSL: BAD_LENGTH error which I have had before and using asyncio was supposed to be the fix.

When I logged the value of self._write_backlog it returned the deque as expected and before the error there was clearly data in it and I believe that self._write_backlog[0] should return the leftmost element in the deque which there appeared to be one.

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f267462e780>
transport: <_SelectorSocketTransport fd=38 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 689, in 
    _process_write_backlog
  del self._write_backlog[0]
IndexError: deque index out of range

On further investigation the same error also seems to happen at a diffrent point in the code but it is the same error like it’s trying to access an empty deque.

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f45f802ec88>
transport: <_SelectorSocketTransport fd=29 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 664, in _process_write_backlog
    data, offset = self._write_backlog[0]
IndexError: deque index out of range

EDIT

The version of python I am running on is 3.7.1 but I have also tried 3.7.3 which gave the same error.

UPDATE

It is believed that this issue is caused by an incompatibility between asyncio and OpenSSL https://bugs.python.org/issue37226

UPDATE 2

A minimal example is available on GitHub

Содержание

  1. Fatal error on SSL transport #3393
  2. Comments
  3. Asyncio Fatal Error on SSL Transport — IndexError Deque Index Out Of Range
  4. Fatal error on SSL transport #67
  5. Comments
  6. Footer
  7. «Fatal error on SSL transport» when exiting python script #20482
  8. Comments
  9. Fatal error on SSL transport #67
  10. Comments
  11. Footer

Fatal error on SSL transport #3393

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 640, in _process_write_backlog
ssldata = self._sslpipe.shutdown(self._finalize)
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 156, in shutdown
ssldata, appdata = self.feed_ssldata(b»)
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 220, in feed_ssldata
self._sslobj.unwrap()
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/ssl.py», line 692, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL] called a function you should not call (_ssl.c:2299)

The text was updated successfully, but these errors were encountered:

I used “try” and tried handle this exception, but I can’ catch it.

GitMate.io thinks the contributor most likely able to help you is @asvetlov.

Possibly related issues are #3242 (Error), #3117 (Fatal read error on socket transport), #3141 (Fatal read error on socket transport ), #2822 (Unexpected SSL error (CERTIFICATE_VERIFY_FAILED)), and #272 (SSL documentation).

Источник

Asyncio Fatal Error on SSL Transport — IndexError Deque Index Out Of Range

I keep running into the bellow error and can’t work out how to fix it or whether it is a bug in asyncio that I need to report. My program works fine is it basically the same as the example in there docs but it can send lots of messages upto 20 per second to multiple clients when there is a low number of updates it works fine but when the number of writes increases I run into this error.

I am using create_server from asyncio to make the server listen for new clients and I believe this creates a new connection on each connection. Not all clients stop only one clients stops and the rest keep running it’s usually the last client that connected but not always. I have played with the asyncio/sslproto.py file removing the reference to [0] and replacing them with popleft which they got me the not very helpful SSL: BAD_LENGTH error which I have had before and using asyncio was supposed to be the fix.

When I logged the value of self._write_backlog it returned the deque as expected and before the error there was clearly data in it and I believe that self._write_backlog[0] should return the leftmost element in the deque which there appeared to be one.

On further investigation the same error also seems to happen at a diffrent point in the code but it is the same error like it’s trying to access an empty deque.

EDIT

The version of python I am running on is 3.7.1 but I have also tried 3.7.3 which gave the same error.

Источник

Fatal error on SSL transport #67

I have cloned the New Monocle.
Now the Scanner has Errors in the Logs Like This.

The text was updated successfully, but these errors were encountered:

I’m not quite sure what the problem is here. Does it happen in the middle of sessions or while exiting? On every request, many, or just a few? Is your internet connection stable?

Yes my internet connection is stable.

Here a littlebit more.

I figured out what this is.
asyncio.sslproto.SSLProtocol and other TCP related errors tend to happen when the server can’t process TCP in a timely manner. While there could be various reasons for this (mostly infra related), one common reason is the maximum CPU usage of server.

Usually, Monocle is very conservative in terms of CPU usage but when doing certain operations like bootstrap, MORE_POINTS, etc, it maxes out CPU and when that happens, server fails to properly process TCP connections and you get those errors.

@MonkeyTedBaker great findings. We find similar issuing on SSLProtocol with the Fatal error on SSL transport . Do you have suggestions to mitigate the issue other than to lower cpu usage? Seems when that happens, many IO/TCP requests are failing

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

«Fatal error on SSL transport» when exiting python script #20482

  • Package Name: azure-eventhub-checkpointstoreblob-aio
  • Package Version: 1.1.4
  • Operating System: MacOs 10.15.7
  • Python Version: 3.9.1

Describe the bug
Error is occurring after exiting python program :

To Reproduce
Steps to reproduce the behavior:
Minimal repro :

Expected behavior
Error should not occur

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

The text was updated successfully, but these errors were encountered:

Thanks for the feedback, we’ll investigate asap.

hey @rjohnsonrxr, I am able to reproduce the issue on windows which gave me more information on the error:

according to the doc of asyncio.run :

This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once.

So I think it’s because the underlying ssl obj is hooked with one asyncio loop in the first asyncio.run , and the loop get closed after the running which leads to the second call find that the previous loop hooked with the ssl obj is already closed.

To bypass it, you could use the same loop to run those two method, so your code could be like:

Please let me whether it works for you or you need any other help.

Источник

Fatal error on SSL transport #67

I have cloned the New Monocle.
Now the Scanner has Errors in the Logs Like This.

The text was updated successfully, but these errors were encountered:

I’m not quite sure what the problem is here. Does it happen in the middle of sessions or while exiting? On every request, many, or just a few? Is your internet connection stable?

Yes my internet connection is stable.

Here a littlebit more.

I figured out what this is.
asyncio.sslproto.SSLProtocol and other TCP related errors tend to happen when the server can’t process TCP in a timely manner. While there could be various reasons for this (mostly infra related), one common reason is the maximum CPU usage of server.

Usually, Monocle is very conservative in terms of CPU usage but when doing certain operations like bootstrap, MORE_POINTS, etc, it maxes out CPU and when that happens, server fails to properly process TCP connections and you get those errors.

@MonkeyTedBaker great findings. We find similar issuing on SSLProtocol with the Fatal error on SSL transport . Do you have suggestions to mitigate the issue other than to lower cpu usage? Seems when that happens, many IO/TCP requests are failing

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Issue

I keep running into the bellow error and can’t work out how to fix it or whether it is a bug in asyncio that I need to report. My program works fine is it basically the same as the example in there docs but it can send lots of messages upto 20 per second to multiple clients when there is a low number of updates it works fine but when the number of writes increases I run into this error.

I am using create_server from asyncio to make the server listen for new clients and I believe this creates a new connection on each connection. Not all clients stop only one clients stops and the rest keep running it’s usually the last client that connected but not always. I have played with the asyncio/sslproto.py file removing the reference to [0] and replacing them with popleft which they got me the not very helpful SSL: BAD_LENGTH error which I have had before and using asyncio was supposed to be the fix.

When I logged the value of self._write_backlog it returned the deque as expected and before the error there was clearly data in it and I believe that self._write_backlog[0] should return the leftmost element in the deque which there appeared to be one.

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f267462e780>
transport: <_SelectorSocketTransport fd=38 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 689, in 
    _process_write_backlog
  del self._write_backlog[0]
IndexError: deque index out of range

On further investigation the same error also seems to happen at a diffrent point in the code but it is the same error like it’s trying to access an empty deque.

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f45f802ec88>
transport: <_SelectorSocketTransport fd=29 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 664, in _process_write_backlog
    data, offset = self._write_backlog[0]
IndexError: deque index out of range

EDIT

The version of python I am running on is 3.7.1 but I have also tried 3.7.3 which gave the same error.

UPDATE

It is believed that this issue is caused by an incompatibility between asyncio and OpenSSL https://bugs.python.org/issue37226

UPDATE 2

A minimal example is available on GitHub

Solution

The problem here is related to system resources when you connect lots of clients it can cause CPU or Memory to become exhausted which then causes this error as the write fails.

The solution is to implement flow control to limit the amount of data being sent at one time and stop resources becoming exhausted the following article has a good example of simple flow control that blocks while old data is removed then resumes using the high and low water marks. When the data exceeds the high water mark it triggers pause_writing then when the data size reduces to lower than the low water mark writing resumes this can cause a noticeable slow down dependent on load.

As an alternative to adding your own flow control to a protocol the asyncio Streams primitives offer a simple way to write and read data that includes flow control by default but for me made implementation harder so I opted to include my own at the protocol level as shown in the linked article.

Answered By — bobthemac

Issue33093

Created on 2018-03-17 17:36 by Eric Toombs, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg314008 — (view) Author: Eric Toombs (Eric Toombs) Date: 2018-03-17 17:36
I'm not exactly sure what caused this error, but I was a client receiving messages on a websocket for a while (about 12 hours). Suddenly all incoming data stopped, then nothing happened for about 5 hours. Finally, I received a ConnectionClosed and the following appeared on stdout:

```
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f17ae393e48>
transport: <_SelectorSocketTransport closing fd=15 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/sslproto.py", line 636, in _process_write_backlog
    ssldata, offset = self._sslpipe.feed_appdata(data, offset)
AttributeError: 'NoneType' object has no attribute 'feed_appdata'
```

I can't imagine this is what was supposed to happen. This has happened about three times now, so I can confirm it is reproducible. I'm writing a minimalist client now to see if I can isolate the problem any further. It's still unclear, though, which layer is responsible---websockets or asyncio. The websockets issue is here:

https://github.com/aaugustin/websockets/issues/356
msg314042 — (view) Author: Matt Eaton (agnosticdev) * Date: 2018-03-18 14:31
Eric, what is needed to try and reproduce this issue accurately?  Would it be installing websockets and setting up your client to ping to the server forever (12 hours in this case)?  If you are able to provide a client I would be willing to setup a test case on my end.
msg314184 — (view) Author: Neil Booth (kyuupichan) * Date: 2018-03-21 02:14
Looks like https://bugs.python.org/issue33037
msg314302 — (view) Author: Eric Toombs (Eric Toombs) Date: 2018-03-23 09:59
Well, that looks good! Looking forward to 3.6.5!
msg314324 — (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-03-23 20:30
Thanks for the report and for the analysis!  Closing as duplicate.
History
Date User Action Args
2022-04-11 14:58:58 admin set github: 77274
2018-03-23 20:30:58 ned.deily set status: open -> closed

superseder: Skip sending/receiving after SSL transport closing

nosy:
+ ned.deily
messages:
+ msg314324
resolution: duplicate
stage: resolved

2018-03-23 11:20:59 ppperry set type: behavior
2018-03-23 09:59:02 Eric Toombs set messages:
+ msg314302
2018-03-21 02:14:13 kyuupichan set nosy:
+ kyuupichan
messages:
+ msg314184
2018-03-18 14:31:29 agnosticdev set nosy:
+ agnosticdev
messages:
+ msg314042
2018-03-17 17:36:10 Eric Toombs create

Fatal error on SSL transport #3393

Comments

yjqiang commented Nov 17, 2018

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 640, in _process_write_backlog
ssldata = self._sslpipe.shutdown(self._finalize)
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 156, in shutdown
ssldata, appdata = self.feed_ssldata(b»)
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 220, in feed_ssldata
self._sslobj.unwrap()
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/ssl.py», line 692, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL] called a function you should not call (_ssl.c:2299)

The text was updated successfully, but these errors were encountered:

yjqiang commented Nov 17, 2018

I used “try” and tried handle this exception, but I can’ catch it.

aio-libs-bot commented Nov 17, 2018

GitMate.io thinks the contributor most likely able to help you is @asvetlov.

Possibly related issues are #3242 (Error), #3117 (Fatal read error on socket transport), #3141 (Fatal read error on socket transport ), #2822 (Unexpected SSL error (CERTIFICATE_VERIFY_FAILED)), and #272 (SSL documentation).

asvetlov commented Nov 17, 2018

What Python and aiohttp versions do yo use?

yjqiang commented Nov 17, 2018

python 3.6.1 and aiohttp 3.4.4 by using pip

asvetlov commented Nov 17, 2018

The problem not in aiohttp itself but in Python asyncio.
Try to upgrade to Python 3.7.1 — it has several asyncio SSL fixes.
I don’t know if these fixes are enough for your case though.

yjqiang commented Nov 17, 2018

I’m using Pythonista on ios, so I can’t upgrade to 3.7.1 by myself. But if the author made it, I would try and give you the feedback.

yjqiang commented Nov 17, 2018

Should I close it now or let it open until …?

yjqiang commented Nov 17, 2018 •

By the way, I think I find the reason of #3117 and #3141 and #3202. Can I reopen #3202 , since I made that issue? And I left a message for you there, several days ago.

asvetlov commented Nov 17, 2018

Yes, better to report on upstream.
Regarding #3202 — let’s briefly discuss your findings with closed issue status and decide what to do after that.

yjqiang commented Nov 17, 2018 •

@asvetlov I wrote something in #3202 few minutes ago.

yjqiang commented Nov 17, 2018

Yes, better to report on upstream.
Regarding #3202 — let’s briefly discuss your findings with closed issue status and decide what to do after that.

Did you read that? I think that’s important.

Источник

«Fatal error on SSL transport» when exiting python script #20482

Comments

rjohnsonrxr commented Aug 31, 2021

  • Package Name: azure-eventhub-checkpointstoreblob-aio
  • Package Version: 1.1.4
  • Operating System: MacOs 10.15.7
  • Python Version: 3.9.1

Describe the bug
Error is occurring after exiting python program :

To Reproduce
Steps to reproduce the behavior:
Minimal repro :

Expected behavior
Error should not occur

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

The text was updated successfully, but these errors were encountered:

xiangyan99 commented Sep 2, 2021

Thanks for the feedback, we’ll investigate asap.

yunhaoling commented Sep 13, 2021

hey @rjohnsonrxr, I am able to reproduce the issue on windows which gave me more information on the error:

according to the doc of asyncio.run :

This function always creates a new event loop and closes it at the end. It should be used as a main entry point for asyncio programs, and should ideally only be called once.

So I think it’s because the underlying ssl obj is hooked with one asyncio loop in the first asyncio.run , and the loop get closed after the running which leads to the second call find that the previous loop hooked with the ssl obj is already closed.

To bypass it, you could use the same loop to run those two method, so your code could be like:

Please let me whether it works for you or you need any other help.

Источник

Fatal error on SSL transport #67

Comments

Memurame commented Jan 28, 2017 •

I have cloned the New Monocle.
Now the Scanner has Errors in the Logs Like This.

The text was updated successfully, but these errors were encountered:

Noctem commented Feb 2, 2017

I’m not quite sure what the problem is here. Does it happen in the middle of sessions or while exiting? On every request, many, or just a few? Is your internet connection stable?

Memurame commented Feb 5, 2017

Yes my internet connection is stable.

Here a littlebit more.

MonkeyTedBaker commented Sep 28, 2017

I figured out what this is.
asyncio.sslproto.SSLProtocol and other TCP related errors tend to happen when the server can’t process TCP in a timely manner. While there could be various reasons for this (mostly infra related), one common reason is the maximum CPU usage of server.

Usually, Monocle is very conservative in terms of CPU usage but when doing certain operations like bootstrap, MORE_POINTS, etc, it maxes out CPU and when that happens, server fails to properly process TCP connections and you get those errors.

jeffpeiyt commented Mar 25, 2018

@MonkeyTedBaker great findings. We find similar issuing on SSLProtocol with the Fatal error on SSL transport . Do you have suggestions to mitigate the issue other than to lower cpu usage? Seems when that happens, many IO/TCP requests are failing

Footer

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

fatal error on ssl transport #571

Comments

yjqiang commented Nov 1, 2018

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 640, in _process_write_backlog
ssldata = self._sslpipe.shutdown(self._finalize)
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 156, in shutdown
ssldata, appdata = self.feed_ssldata(b»)
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/sslproto.py», line 220, in feed_ssldata
self._sslobj.unwrap()
File «/var/containers/Bundle/Application/84DF3BDF-B442-41B6-93B3-AB45EDA9E5FC/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/ssl.py», line 692, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL] called a function you should not call (_ssl.c:2299)

The text was updated successfully, but these errors were encountered:

yjqiang commented Nov 1, 2018

pythonista 320000 python 3.6.1 aiohttp 3.4.4

cclauss commented Nov 1, 2018 •

Please also provide a minimal code snippet that generates this error message.

Источник

AttributeError: ‘NoneType’ object has no attribute ‘feed_appdata’ #2546

Comments

binrush commented Nov 22, 2017

Long story short

We have small aiohttp-based running on many customers servers. All errors from these servers are reported to Sentry. There are many errors whitch looks like aiohttp bugs, here’s details:

Steps to reproduce

Unfortunately, we can not reproduce this issue on our environment and do not have access to affected servers.

Your environment

aiohttp server 2.3.2
Centos 6/7

The text was updated successfully, but these errors were encountered:

asvetlov commented Nov 22, 2017

Thanks for report.
The problem is actually in asyncio itself.
I’m trying to write a complex fix for SSL transport but it takes a while.
You can simply ignore this noisy error message.

P.S.
Let’s keep the issue open for the reference for a while.

bigbagboom commented Dec 20, 2017 •

same error I got:

waiting for the fix. Thanks a lot.

agronholm commented Feb 1, 2018

I hit this one too but not with aiohttp. Is there a relevant issue on CPython’s bug tracker?

asvetlov commented Feb 2, 2018

There are several issues related to asyncio ssl support, I’ll address them before new Python release.

thehesiod commented Feb 6, 2018

just hit this too

daniel-kukiela commented Feb 16, 2018

I have the same issue, just to let you know 🙂

vladiscripts commented Feb 16, 2018

thomaszdxsn commented Feb 23, 2018

I too. have something temp way fix it? pls

asvetlov commented Feb 23, 2018

The error is harmless, you could just ignore it.
asyncio tries to write into closed SSL connection and fails — but nothing is corrupted, the socket is closed successfully etc. Bug fix should just ignore such write tries.
I’ll apply the fix to Python 3.6.5

daniel-kukiela commented Feb 23, 2018 •

It depends.
It harms our voice channel steram using discordpy. I’m not sure if that’s because discordpy doesn’t handle that error from aiohttp, or aiohttp doesn’t handle error from asyncio.
End result — i can’t handle that in my code, no indicators that something happend, stream «looks» as usual, like nothing happend, but no data is streamed (i don’t even have a way to check and restart stream).
(i’m waiting for a next occurence of that issue to grab full stack and see)

asvetlov commented Feb 23, 2018

I pretty sure discord problem is not related.

daniel-kukiela commented Feb 23, 2018 •

The relation is stream breaks and i see that error in console. Or in other words — if that error occurs, stream breaks, but discordpy «doesn’t know» about that and is still streaming (no further error of any type, it just «streams» like nothing happend, but of course no data is transferred).
I’ll try to find out what and where doesn’t handle that properly and update here if necessary.

asvetlov commented Feb 23, 2018

Socket is closed before displaying the message, writing into closed socket is an error anyway.

Insoleet commented Mar 2, 2018

Probably related, additionnaly to the error reported in this issue, I also get such errors :

Insoleet commented Mar 9, 2018

Does this error means we need to reinit the Client Session before trying to send new requests ?

asvetlov commented Mar 9, 2018

I guess no. Just ignore all errors that happen on connection closing.

asvetlov commented Mar 10, 2018 •

Fixed in upstream, please test on Python 3.6.5

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there’s important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

Footer

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Я продолжаю сталкиваться с приведенной ниже ошибкой и не могу понять, как ее исправить или это ошибка в asyncio, о которой мне нужно сообщить. Моя программа работает нормально, в основном она такая же, как в примере документы, но она может отправлять много сообщений до 20 в секунду нескольким клиентам, когда есть небольшое количество обновлений, она работает нормально, но когда количество записей увеличивается, я сталкиваюсь с эта ошибка.

Я использую create_server из asyncio, чтобы заставить сервер слушать новых клиентов, и я считаю, что это создает новое соединение для каждого соединения. Не все клиенты останавливаются, останавливается только один клиент, а остальные продолжают работать, обычно это последний клиент, который подключился, но не всегда. Я поиграл с файлом asyncio/sslproto.py, удалив ссылку на [0] и заменив их на popleft, что привело к не очень полезной ошибке SSL: BAD_LENGTH, которая у меня была раньше, и использование asyncio должно было исправить.

Когда я записал значение self._write_backlog, оно вернуло очередь, как и ожидалось, и до ошибки в ней явно были данные, и я считаю, что self._write_backlog[0] должен возвращать крайний левый элемент в очереди, который, как оказалось, был один.

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f267462e780>
transport: <_SelectorSocketTransport fd=38 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 689, in 
    _process_write_backlog
  del self._write_backlog[0]
IndexError: deque index out of range

При дальнейшем расследовании та же ошибка, по-видимому, также возникает в другой точке кода, но это та же ошибка, что и при попытке доступа к пустой очереди.

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f45f802ec88>
transport: <_SelectorSocketTransport fd=29 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 664, in _process_write_backlog
    data, offset = self._write_backlog[0]
IndexError: deque index out of range

РЕДАКТИРОВАТЬ

Версия Python, на которой я работаю, — 3.7.1, но я также пробовал 3.7.3, которая выдавала ту же ошибку.

ОБНОВИТЬ

Считается, что эта проблема вызвана несовместимостью между asyncio и OpenSSL https://bugs.python.org/issue37226.

ОБНОВЛЕНИЕ 2

Минимальный пример доступен на Гитхаб.

I have been using a certain python api wrapper for a while, for use of the apis for roblox.com. It works very well, and I have added in quite a few custom functions in the past for apis it didn’t already include. Just recently however, I ran into a problem.

I created this function inside the wrapper, in the manner I have always done:

async def get_user_items(self, user_id):
        items = []
        baseUrl = f'https://inventory.roblox.com/v1/users/{user_id}/assets/collectibles?sortOrder=Asc&limit=100'
        r = await self.request.request(url=baseUrl, method='GET', headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'})
        data = json.loads(r.content)
        for item in data['data']:
            items.append({'asset_id':item['assetId'], 'ua_id':item['serialNumber']})
        cursor = data['nextPageCursor']
        while cursor != None:
            r = await self.request.request(url=baseUrl + f'&cursor={cursor}', method='GET', headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'})
            data = json.loads(r.content)
            for item in data['data']:
                
                items.append({'asset_id':item['assetId'], 'ua_id':item['serialNumber']})
            cursor = data['nextPageCursor']
        return items

The problem is, that when I test it out, it errors at the line «r = await self.request.request(url=baseUrl, method=’GET’, headers={‘User-Agent’:’Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36′})».

This is the error:

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x000001A2EA00AB20>
transport: <_ProactorSocketTransport fd=960 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciosslproto.py", line 685, in _process_write_backlog
    self._transport.write(chunk)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasyncioproactor_events.py", line 359, in write
    self._loop_writing(data=bytes(data))
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasyncioproactor_events.py", line 395, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'
Traceback (most recent call last):
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciosslproto.py", line 685, in _process_write_backlog
    self._transport.write(chunk)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasyncioproactor_events.py", line 359, in write
    self._loop_writing(data=bytes(data))
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasyncioproactor_events.py", line 395, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:UsersKDJDesktopAuto Manual Tradermain.py", line 117, in <module>
    asyncio.run(main())
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciorunners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciobase_events.py", line 616, in run_until_complete
    return future.result()
  File "C:UsersKDJDesktopAuto Manual Tradermain.py", line 112, in main
    their_user_items = await client.get_user_items(user_id)
  File "C:UsersKDJDesktopAuto Manual Traderrobloxapiclient.py", line 148, in get_user_items
    r = await self.request.request(url=baseUrl, method='GET', headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'})
  File "C:UsersKDJDesktopAuto Manual Traderrobloxapiutilsrequest.py", line 49, in request
    r = await self.requests.request(kwargs['method'], kwargs['url'], headers=self.headers, cookies=self.cookies, data=kwargs.get('data'))
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3client.py", line 541, in request
    response = await self.send(
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3client.py", line 140, in send
    response = await self.send_handling_redirects(
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3client.py", line 177, in send_handling_redirects
    response = await self.dispatch.send(
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3dispatchconnection_pool.py", line 130, in send
    raise exc
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3dispatchconnection_pool.py", line 120, in send
    response = await connection.send(
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3dispatchconnection.py", line 56, in send
    response = await self.h2_connection.send(request, timeout=timeout)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3dispatchhttp2.py", line 43, in send
    stream_id = await self.send_headers(request, timeout)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3dispatchhttp2.py", line 86, in send_headers
    await self.writer.write(data_to_send, timeout)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libsite-packageshttp3concurrency.py", line 129, in write
    self.stream_writer.write(data)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciostreams.py", line 341, in write
    self._transport.write(data)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciosslproto.py", line 387, in write
    self._ssl_protocol._write_appdata(data)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciosslproto.py", line 599, in _write_appdata
    self._process_write_backlog()
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciosslproto.py", line 707, in _process_write_backlog
    self._fatal_error(exc, 'Fatal error on SSL transport')
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciosslproto.py", line 721, in _fatal_error
    self._transport._force_close(exc)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasyncioproactor_events.py", line 151, in _force_close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciobase_events.py", line 719, in call_soon
    self._check_closed()
  File "C:UsersKDJAppDataLocalProgramsPythonPython38libasynciobase_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')

It seems to have something to due with asyncio. I’ve been trying to find a solution, but I can’t seem to prevent getting that error.

Things I’ve tried:
Reinstalling asyncio with —no-cache-dir
Reinstalling my wrapper( I’m pretty sure that wrapper has nothing to due with the issue )
Researching the error( I couldn’t find anything that seems related to what I’m doing )

It’s such a simple request function, but for some reason the request( r = await self.request.request… ) breaks asyncio.

Does anyone have a solution, or even a clue to what’s going on? Tell me if you would like to see the entirety of the code. Thanks!

Skip to content



Open


Issue created Dec 02, 2016 by Andrew Leech@andrewleechOwner

SSL error

2016-12-02 20:03:16,840 ERROR Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fa164036c18>
transport: <_SelectorSocketTransport closing fd=42 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
File «/usr/lib/python3.5/asyncio/sslproto.py», line 628, in _process_write_backlog
ssldata = self._sslpipe.shutdown(self._finalize)
File «/usr/lib/python3.5/asyncio/sslproto.py», line 151, in shutdown
raise RuntimeError(‘shutdown in progress’)
RuntimeError: shutdown in progress
2016-12-02 20:03:16,842 ERROR Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fa14ffafeb8>
transport: <_SelectorSocketTransport closing fd=59 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
File «/usr/lib/python3.5/asyncio/sslproto.py», line 628, in _process_write_backlog
ssldata = self._sslpipe.shutdown(self._finalize)
File «/usr/lib/python3.5/asyncio/sslproto.py», line 151, in shutdown
raise RuntimeError(‘shutdown in progress’)
RuntimeError: shutdown in progress
2016-12-02 20:03:16,842 ERROR Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fa14ffafb38>
transport: <_SelectorSocketTransport closing fd=60 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
File «/usr/lib/python3.5/asyncio/sslproto.py», line 628, in _process_write_backlog
ssldata = self._sslpipe.shutdown(self._finalize)
File «/usr/lib/python3.5/asyncio/sslproto.py», line 151, in shutdown
raise RuntimeError(‘shutdown in progress’)
RuntimeError: shutdown in progress
2016-12-02 20:03:16,842 ERROR Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fa1640612b0>
transport: <_SelectorSocketTransport closing fd=61 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
File «/usr/lib/python3.5/asyncio/sslproto.py», line 628, in _process_write_backlog
ssldata = self._sslpipe.shutdown(self._finalize)
File «/usr/lib/python3.5/asyncio/sslproto.py», line 151, in shutdown
raise RuntimeError(‘shutdown in progress’)
RuntimeError: shutdown in progress
2016-12-02 20:03:17,022 ERROR Task exception was never retrieved
future: <Task finished coro=<_delete_folder() done, defined at /home/corona/feralsync/feralsync/feral_sync.py:74> exception=TimeoutError()>
Traceback (most recent call last):
File «/usr/lib/python3.5/asyncio/tasks.py», line 241, in _step
result = coro.throw(exc)
File «/home/corona/feralsync/feralsync/feral_sync.py», line 80, in _delete_folder
await webdav.delete(remote_path)
File «/home/corona/feralsync/aioeasywebdav/aioeasywebdav/client.py», line 254, in delete
async with (await self._send(‘DELETE’, path, 204)):
File «/home/corona/feralsync/aioeasywebdav/aioeasywebdav/client.py», line 192, in _send
response = await self.session.request(method, url, allow_redirects=False, **kwargs)
File «/home/corona/feralsync/virtualenv_linux/lib/python3.5/site-packages/aiohttp/client.py», line 524, in await
resp = yield from self._coro
File «/home/corona/feralsync/virtualenv_linux/lib/python3.5/site-packages/aiohttp/client.py», line 165, in _request
conn = yield from self._connector.connect(req)
File «/home/corona/feralsync/virtualenv_linux/lib/python3.5/site-packages/async_timeout/init.py», line 44, in exit
raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError
2016-12-02 20:03:17,069 ERROR _sync_folder timeout

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error occurred сталкер при запуске
  • Fatal error u1052
  • Fatal error occurred сталкер update
  • Fatal error turning off hash boards power
  • Fatal error occurred сталкер ogse

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии