getsentry / getsentry/sentry-python

Resolve `RuntimeError: Cannot install a trace function while another trace function is being installed`

未關閉
#7,014 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Python
主要語言
Python
星號
2.2k
分支
669
平均合併
1 天 1 小時
30 天內合併 PR
213

描述

I keep seeing this:

```
__________ test_nonstreaming_chat_completion[False-True-False-False] ___________
/usr/lib/python3.10/threading.py:973: in _bootstrap
self._bootstrap_inner()
/usr/lib/python3.10/threading.py:1011: in _bootstrap_inner
_sys.settrace(_trace_hook)
E RuntimeError: Cannot install a trace function while another trace function is being installed

The above exception was the direct cause of the following exception:
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/runner.py:361: in from_call
result: TResult | None = func()
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/runner.py:250: in
lambda: runtest_hook(item=item, **kwds),
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/pluggy/_hooks.py:512: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/logging.py:865: in pytest_runtest_call
yield
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
return result.get_result()
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
res = yield
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/capture.py:900: in pytest_runtest_call
return (yield)
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/skipping.py:268: in pytest_runtest_call
return (yield)
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/unraisableexception.py:183: in pytest_runtest_call
collect_unraisable(item.config)
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/unraisableexception.py:79: in collect_unraisable
raise errors[0]
.tox/py3.10-litellm-v1.89.6/lib/python3.10/site-packages/_pytest/unraisableexception.py:67: in collect_unraisable
warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E pytest.PytestUnraisableExceptionWarning: Exception ignored in thread started by: >
E Enable tracemalloc to get traceback where the object was allocated.
E See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
```

貢獻指南

開啟貢獻指南

研究方向

Reproduce the failure in test_nonstreaming_chat_completion[False-True-False-False] under Python 3.10, then inspect the daemon Thread-6 (_flush_loop) and the tracing setup shown in the traceback. Done means the test completes without the RuntimeError or the resulting pytest unraisable-exception warning.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
testing-qa
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
需要釐清
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。