JDK 11 | JDK 17 | JDK 21 | JDK 22 | JDK 23 | JDK 8 |
---|---|---|---|---|---|
11.0.25-oracleFixed | 17.0.13-oracleFixed | 21.0.5-oracleFixed | 22.0.2Fixed | 23 b16Fixed | 8u431Fixed |
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
BasicDirectoryModel.validateFileCache starts a background thread, a FilesLoader object, to update the list of files in the current directory. First, the method checks if there's an existing filesLoader and interrupts it. Then it creates a new filesLoader. The above is done without any synchronisation, which means if the method is called concurrently by several threads, several fileLoader threads could be started concurrently. If it happens, only the latest one may be interrupted. A similar problem exists in invalidateFileCache, access to filesLoader field isn't protected by a lock. BasicDirectoryModel.FilesLoader.cancelRunnables has a data race too. The 'runnable' field is a volatile field, but it's not enough. It is possible that runnable is not null when the condition is checked but becomes null in the body of the if statement. It could be set a new value too.
|