oracle / oci-hdfs-connector

HDFS Connector for Oracle Cloud Infrastructure
https://cloud.oracle.com/cloud-infrastructure
Other
27 stars 26 forks source link

exists()/mkdirs() race in BmcFileBackedOutputStream.java #16

Closed tkuthan closed 5 years ago

tkuthan commented 5 years ago

https://github.com/oracle/oci-hdfs-connector/blob/aeeac0e2b3a71a49286ec670b913edf600cf0607/hdfs-connector/src/main/java/com/oracle/bmc/hdfs/store/BmcFileBackedOutputStream.java#L65

There is a race between java.io.File::exists() and java.io.File:mkdirs() in createBufferFile().

First an existence of a directory is checked and if it does not exist, the directory is created.

If two threads are executing this code, following schedule is possible: 1) threadA: exists("/tmp/hadoop-root") returns false 2) threadB: exists("/tmp/hadoop-root") returns false 3) threadA: mkdirs("/tmp/hadoop-root") succeeds 4) threadB: mkdirs("/tmp/hadoop-root") fails and IOException is thrown

sumitkdey commented 5 years ago

@tkuthan thanks for reporting this issue. We are working on a fix.

piyushg commented 5 years ago

@sumitkdey, do we have any ETA?

sumitkdey commented 5 years ago

The fix is now available in release 2.9.2.0.