wildedge-python icon indicating copy to clipboard operation
wildedge-python copied to clipboard

A second WildEdge client in the same process records no auto-instrumented events

Open piotrekno1 opened this issue 1 month ago • 0 comments

What happens

Integration patches are installed once per process and stay bound to the client that installed them. If that client is closed and a new one is created (re-init, tests, a long-running worker that reconfigures), the new client records nothing from auto-instrumented models, without any warning.

c1 = wildedge.WildEdge(dsn=...); c1.instrument("onnx")
ort.InferenceSession(path).run(...)   # c1: model_load, inference
c1.close()
c2 = wildedge.WildEdge(dsn=...); c2.instrument("onnx")
ort.InferenceSession(path).run(...)   # c2: no events

Each install_auto_load_patch keeps client_ref (a weakref to the first client) and a module flag such as _ort_patched. Later instrument() calls return early because the flag is set, and the patched constructors skip the closed client.

Expected

A later client should take over: route the patches through the current default client, or let instrument() rebind client_ref when the old client is closed. At least log a warning when instrument() finds patches bound to another client.

Repro

Checked with onnxruntime 1.31.0. The compat suite now uses one client per process to work around this (tests/compat/conftest.py).

🤖 Generated with Claude Code

piotrekno1 avatar Oct 20 '26 13:10 piotrekno1