False alarms when detecting resource leaks in multi-threading code
- Dominant language
- OCaml
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 19h 36m
- Merged PRs (30d)
- 13
Description
Dear Infer developers,
I am testing Infer with some open-source projects. I found that Infer may report false alarms when analyzing multi-threading code. Here is a simple example
```
public void foo() throws Exception {
final FileInputStream fis = new FileInputStream(new File("hello.txt"));
new Thread() {
@Override
public void run() {
try {
//do something...
fis.close();
} catch(Exception e){
//...
}
}
}.start();
}
```
I think there won't be resource leak here since `fis` is closed in the new thread, but Infer would still report a warning. Why is that?
Contributor guide
Assessment
This issue has not been assessed yet.