Skip to content

Conversation

@SoloJacobs
Copy link
Owner

This commit addresses the following error:

 time=2025-11-14T16:14:59.573Z level=ERROR source=main.go:559
msg="Listen error" err="listen tcp 127.0.0.1:36357: bind: address
already in use"

freeAddress is called multiple times within one test, but also in parallel in multiple tests. freeAddress immediately releases the port despite it being used later in a test. This causes ports to errorenously to be reused.

We replace net.Listen in order to avoid calling syscall.Listen. This way the port can be reused by AM, without the kernel assuming that port can be reused by other processes specifiying port 0.

Fixes: prometheus#4742

This commit addresses the following error:
```
 time=2025-11-14T16:14:59.573Z level=ERROR source=main.go:559
msg="Listen error" err="listen tcp 127.0.0.1:36357: bind: address
already in use"
```

`freeAddress` is called multiple times within one test, but also in
parallel in multiple tests. `freeAddress` immediately releases the port
despite it being used later in a test. This causes ports to errorenously
to be reused.

We replace `net.Listen` in order to avoid calling `syscall.Listen`. This
way the port can be reused by AM, without the kernel assuming that port
can be reused by other processes specifiying port `0`.

Fixes: prometheus#4742
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
@SoloJacobs SoloJacobs force-pushed the main branch 3 times, most recently from ee148b2 to 154ef66 Compare November 18, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix flakes in TestMergeAlerts

2 participants