facebook / facebook/infer

FALSE NEGATIVE: PULSE_RESOURCE_LEAK misses an unclosed connected Socket

Open
#2,120 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

**Affected tool**

`Infer 1.3.0`

**Affected checker**

`Infer PULSE_RESOURCE_LEAK`

**Minimal reproducer**

```java
import java.io.IOException;
import java.net.Socket;

class InferPulseSocketLeak {
void test() throws IOException {
Socket socket = new Socket("localhost", 8080);
socket.getOutputStream().write(42);
}
}
```

**Reproduction command**

```bash
infer --version
infer run --pulse --enable-issue-type PULSE_RESOURCE_LEAK -- javac infer-pulse-resourceleak-fn-socket.java
```

**Current behavior**

Infer 1.3.0 completes successfully with no `PULSE_RESOURCE_LEAK` finding. The result was reproduced twice with the minimal program.

**Expected behavior**

Infer should report the connected `Socket` allocation at line 6. It is a closeable network resource and is neither closed nor returned after its output stream is used.

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.