Skip to content

Commit 6061ab5

Browse files
fix(aap): fixing asyncio error for asgi [backport 3.14] (#14701)
Backport ebd1e38 from #14700 to 3.14. ## Description Customer experienced error on stream endpoint on Daphne/Django application ## Testing This fix was tested on the repro application provided by the customer ## Additional Notes Importing asyncio globally may create bad interaction with gevent APPSEC-59237 Co-authored-by: Christophe Papazian <[email protected]>
1 parent f38225b commit 6061ab5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ddtrace/appsec/_handlers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import asyncio
21
import io
32
import json
43
from typing import Any
@@ -171,6 +170,9 @@ def _on_lambda_parse_body(
171170

172171
async def _on_asgi_request_parse_body(receive, headers):
173172
if asm_config._asm_enabled:
173+
# This must not be imported globally due to 3rd party patching timeline
174+
import asyncio
175+
174176
more_body = True
175177
body_parts = []
176178
try:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
AAP: This fix resolves an issue where stream endpoints with daphne/django where unresponsive due to an asyncio error.

0 commit comments

Comments
 (0)