Baunsgaard commented on code in PR #2019: URL: https://github.com/apache/systemds/pull/2019#discussion_r1567401878
########## src/main/java/org/apache/sysds/runtime/util/DoubleBufferingOutputStream.java: ########## @@ -75,6 +75,9 @@ public void write(byte[] b, int off, int len) throws IOException { // To avoid this we simply write the given byte array without a buffer. // This approach only works if the caller adhere to not modify the byte array given _locks[_pos] = _pool.submit(() -> writeBuffer(b, off, len)); + // get the task to reduce the risk ( and at least block the current thread) + // to avoid race conditions from callers. + _locks[_pos].get(); Review Comment: This fixes the issue for a single thread caller. -- 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. To unsubscribe, e-mail: dev-unsubscr...@systemds.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org