FasterXML / aalto-xml

Ultra-high performance non-blocking XML processor (Stax API + extensions)
Apache License 2.0
288 stars 70 forks source link

`BufferRecycler` access not safe if readers/writers used from different threads #69

Closed cowtowncoder closed 5 years ago

cowtowncoder commented 5 years ago

(note: related to https://github.com/FasterXML/woodstox/issues/82)

The way buffer recycling works with BufferRecycler assumes that not only is access to reading, writing single-threaded (which typically is true), access to any particular parser, generator is from a single thread. But this is not necessarily true, especially in case of async parsing where processing thread may change over time in pipeline setups for example.

Handling should be changed to make this usage safe, using experience from Jackson and Woodstox on adding simple safeguards and synchronization.