Commit da62a6b
committed
fix: pooled processor owns its InferenceConfig instead of referencing it (#76)
BackendBase::m_inference_config was an InferenceConfig& bound to the config of
the session that first created the processor. Because processors are pooled and
shared between sessions with equal configs (the default), a pooled processor can
outlive that session. Each session's InferenceConfig is host-owned, so releasing
the originating session frees the config while the pooled processor (still used
by a peer session) keeps referencing it — a use-after-free on the next inference.
Make the member an owned value so the processor's config lifetime matches the
processor. This fixes all four backends at once: each backend's Instance is
constructed with the processor's m_inference_config and lives inside the
processor, so the instances' InferenceConfig& now alias the processor-owned copy
rather than a session's. The pool keys on operator== (value equality), so sharing
behaviour is unchanged.
Flips the regression test added in the previous commit from failing to passing.1 parent d3cd827 commit da62a6b
1 file changed
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| |||
76 | 84 | | |
77 | 85 | | |
78 | 86 | | |
79 | | - | |
80 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
0 commit comments