Skip to content

Commit d073cc5

Browse files
test(appsec): bound tracer shutdown in test app endpoints DD_U55XLN
The /shutdown endpoints called tracer.shutdown() with no timeout (django) or with the same 10s the client uses (flask). Under a gunicorn gevent worker the flush can block the hub the writer needs, so the request read-timed-out and the test failed with the server still alive and the port still bound. Bound both flushes to 5s, below the client's 10s timeout. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 5fe261d commit d073cc5

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

tests/appsec/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ def iast_code_injection_vulnerability():
337337

338338
@app.route("/shutdown", methods=["GET"])
339339
def shutdown_view():
340-
tracer.shutdown(timeout=10)
340+
# Below the caller's 10s timeout, so the flush gives up before the request does.
341+
tracer.shutdown(timeout=5)
341342
sys.exit(0)
342343

343344

tests/appsec/integrations/django_tests/django_app/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
def shutdown(request):
1717
# Endpoint used to flush traces to the agent when doing snapshots.
18-
tracer.shutdown()
18+
# Bounded: the default waits forever, and under gevent the flush can block the writer's hub.
19+
tracer.shutdown(timeout=5)
1920
return HttpResponse(status=200)
2021

2122

0 commit comments

Comments
 (0)