facebook / facebook/infer

False alarms when detecting resource leaks in multi-threading code

Open
#695 0 comments 0 reactions 0 assignees View on GitHub
false-positive
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.