924060929 opened a new issue #5335: URL: https://github.com/apache/incubator-doris/issues/5335
**Describe the bug** When I use spark on doris with config `doris.deserialize.arrow.async=true`,ScalaValueReader throw TApplicationException: get_next failed: out of sequence response: expected 21 but got 20. And then, ScalaValueReader will **block forever** This is because, when `doris.deserialize.arrow.async=true`, `get_next()` will invoke in **asyncThread**,but `close()` will invoke in **current thread**, the sequence will encounter race condition **To Reproduce** run ``` scala val sparkSettings = new SparkSettings(sparkConf) sparkSettings.setProperty("doris.deserialize.arrow.async", "true") val partitions = RestService.findPartitions(sparkSettings, logger) val reader = new ScalaDorisRowValueReader(partitions.get(0), partitions.get(0).settings()) while (reader.hasNext) { val nextBatch = reader.next // invoke in asyncThread } reader.close() // invoke in current thread ``` **Expected behavior** No exception **Screenshots**  **Desktop (please complete the following information):** None **Smartphone (please complete the following information):** None **Additional context** None ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org