uniVocity-parsers is a suite of extremely fast and reliable parsers for Java. It provides a consistent interface for handling different file formats, and a solid framework for the development of new parsers.
This does not reliably cause an exception to be thrown because repeatedly closing a Reader is fine as per the Java spec, but I believe it should still be addressed.
Hi,
I believe I found a data race in ConcurrentCharLoader.java , which can be triggered by default normal use of the CsvParser library.
Here's a sample minimal code that triggers the issue: https://gist.github.com/spalac24/0256b40b1d6652fdb30e91624f7b5ed0
In short, that code causes
stopReading()
to be called both from https://github.com/uniVocity/univocity-parsers/blob/master/src/main/java/com/univocity/parsers/common/input/concurrent/ConcurrentCharLoader.java#L101 (which runs in its own thread by default) and https://github.com/uniVocity/univocity-parsers/blob/master/src/main/java/com/univocity/parsers/common/input/concurrent/ConcurrentCharInputReader.java#L85 concurrently, butstopReading()
is not thread safe.This does not reliably cause an exception to be thrown because repeatedly closing a
Reader
is fine as per the Java spec, but I believe it should still be addressed.