INNER CODE UNIT · Python
debug_stack
KatrielMoses/voidaccess · api/main.py:672
async def debug_stack(_=Depends(get_current_user)) -> dict:
"""Returns a list of all running asyncio tasks and their stack traces.
Authenticated-only: exposes internal runtime state (filenames, coroutine
names, in-flight task stacks), matching the auth gate on its sibling
/debug/tor-test and /debug/search-test endpoints.
"""
import asyncio
tasks = asyncio.all_tasks()
out = []
for i, t in enumerate(tasks):
stack = []
for f in t.get_stack():
stack.append(f"{f.f_code.co_filename}:{f.f_lineno} in {f.f_code.co_name}")
out.append({
"task_id": i,
"name": t.get_name(),