Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
network
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
9
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
funkwhale
network
Commits
cb8a09ed
Commit
cb8a09ed
authored
2 years ago
by
jooola
Browse files
Options
Downloads
Patches
Plain Diff
fix: remove ignore_aiohttp_ssl_error workaround
Part-of: <
!58
>
parent
0ae4d86c
No related branches found
Branches containing commit
No related tags found
1 merge request
!58
test: add flake linter
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
funkwhale_network/cli.py
+0
-58
0 additions, 58 deletions
funkwhale_network/cli.py
with
0 additions
and
58 deletions
funkwhale_network/cli.py
+
0
−
58
View file @
cb8a09ed
import
asyncio
import
functools
import
ssl
import
sys
import
aiohttp
...
...
@@ -12,67 +11,10 @@ from funkwhale_network.worker import WorkerSettings
from
.
import
output
SSL_PROTOCOLS
=
(
asyncio
.
sslproto
.
SSLProtocol
,)
try
:
import
uvloop.loop
except
ImportError
:
pass
else
:
SSL_PROTOCOLS
=
(
*
SSL_PROTOCOLS
,
uvloop
.
loop
.
SSLProtocol
)
def
ignore_aiohttp_ssl_eror
(
loop
):
"""
Ignore aiohttp #3535 / cpython #13548 issue with SSL data after close
There is an issue in Python 3.7 up to 3.7.3 that over-reports a
ssl.SSLError fatal error (ssl.SSLError: [SSL: KRB5_S_INIT] application data
after close notify (_ssl.c:2609)) after we are already done with the
connection. See GitHub issues aio-libs/aiohttp#3535 and
python/cpython#13548.
Given a loop, this sets up an exception handler that ignores this specific
exception, but passes everything else on to the previous exception handler
this one replaces.
Checks for fixed Python versions, disabling itself when running on 3.7.4+
or 3.8.
"""
if
sys
.
version_info
>=
(
3
,
7
,
4
):
return
orig_handler
=
loop
.
get_exception_handler
()
def
ignore_ssl_error
(
loop
,
context
):
if
context
.
get
(
"
message
"
)
in
{
"
SSL error in data received
"
,
"
Fatal error on transport
"
,
"
SSL handshake failed
"
,
"
[SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error
"
,
}:
# validate we have the right exception, transport and protocol
exception
=
context
.
get
(
"
exception
"
)
protocol
=
context
.
get
(
"
protocol
"
)
if
(
isinstance
(
exception
,
ssl
.
SSLError
)
and
exception
.
reason
in
(
"
KRB5_S_INIT
"
,
"
TLSV1_ALERT_INTERNAL_ERROR
"
)
and
isinstance
(
protocol
,
SSL_PROTOCOLS
)
):
if
loop
.
get_debug
():
asyncio
.
log
.
logger
.
debug
(
"
Ignoring asyncio SSL KRB5_S_INIT error
"
)
return
if
orig_handler
is
not
None
:
orig_handler
(
loop
,
context
)
else
:
loop
.
default_exception_handler
(
context
)
loop
.
set_exception_handler
(
ignore_ssl_error
)
def
async_command
(
f
):
def
wrapper
(
*
args
,
**
kwargs
):
loop
=
asyncio
.
get_event_loop
()
ignore_aiohttp_ssl_eror
(
loop
)
return
loop
.
run_until_complete
(
f
(
*
args
,
**
kwargs
))
return
functools
.
update_wrapper
(
wrapper
,
f
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment