Skip to content

Fix #384: change handling of SmileBufferRecycler to be thread-safe#385

Merged
cowtowncoder merged 1 commit into2.15from
tatu/384-fix-smile-buffer-recycler
Jun 19, 2023
Merged

Fix #384: change handling of SmileBufferRecycler to be thread-safe#385
cowtowncoder merged 1 commit into2.15from
tatu/384-fix-smile-buffer-recycler

Conversation

@cowtowncoder
Copy link
Copy Markdown
Member

Simplify SmileBufferRecycler by using AtomicReference to guard access to buffers. This didn't use to be problematic before async handling (when there was typically 1-to-1 matching between threads and Parser/Generator instances).
However, this changed for both:

  1. Async Smile parser
  2. Non-blocking frameworks where access to input is not handled with BIO (and as a result there's no thread-to-parser/generator binding)

and so there's no guarantee of atomicity for reuse by recycler.

@cowtowncoder
Copy link
Copy Markdown
Member Author

@simondaudin I think this should fix it; will merge but would appreciate if you could verify on your end. Targeting 2.15 branch for eventual 2.15.3 release (and 2.16.0).

@cowtowncoder cowtowncoder added this to the 2.15.3 milestone Jun 19, 2023
@cowtowncoder cowtowncoder merged commit ce68a2b into 2.15 Jun 19, 2023
@cowtowncoder cowtowncoder deleted the tatu/384-fix-smile-buffer-recycler branch June 19, 2023 20:25
@simondaudin
Copy link
Copy Markdown

@cowtowncoder Thank you for the fix, that was fast !
I tested with:

  • The test I has given in the issue -> OK
  • A test I had with some of our application logic -> also OK
    For my point of view, it's fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants