Fix tokenizer lifecycle close races#114
Conversation
Review: Fix tokenizer lifecycle close racesOverall this is a well-structured fix for the races described in #108. The Issues
if rc != 0 {
return nil, errors.Wrap(...) // buffers not freed here
}
defer func() { /* free buffers */ }()If the Rust side returns an error but has partially populated
tok.lifecycleMu.RLock()This is fine for a white-box test in the same package, but it could silently break if the locking strategy changes. A small comment noting the intent ("simulate an in-flight FFI call") would help future readers. Minor
|
Benchmark Comparison |
|
@claude PTAL |
|
Claude finished @tazarov's task in 1m 37s —— View job Re-review: Fix tokenizer lifecycle close races
Good progress since the last review. The follow-up commits added Here's what I found on re-review: Remaining issue from previous review
The if rc < 0 {
lastError := getErrorForCode(rc)
return nil, errors.Wrap(lastError, "failed to encode pairs") // buffers not freed
}
defer func() {
for i := range buffers {
t.freeBuffer(&buffers[i])
}
}()Note:
|
Summary
Testing
Closes #108