Skip to content

[6.x] [Test] Pick spec ports outside the ephemeral port range - #292

Merged
jsvd merged 1 commit into
logstash-plugins:6.xfrom
jsvd:fix-flaky-port-allocation-spec-6.x
Nov 4, 2026
Merged

jsvd merged 1 commit into
logstash-plugins:6.xfrom
jsvd:fix-flaky-port-allocation-spec-6.x

Conversation

@jsvd

@jsvd jsvd commented Nov 4, 2026

Copy link
Copy Markdown
Member

Backport of #291 to 6.x, adapted to 6.x's spec helper.

get_port picked a random port in 10000..65535, checked it was free and released it before the plugin bound it. Ports above 32767 are in the kernel's ephemeral range, so in between another socket can be handed the same port, failing with could not bind ... Address already in use. It now picks from 10000..32767, below both the Linux (32768-60999) and macOS (49152-65535) ephemeral ranges. Spec-only change.

Seen on 6.x, e.g. tcp_spec.rb:296 "should one message per connection" with Address already in use: https://github.com/logstash-plugins/logstash-input-tcp/actions/runs/33371780619

Locally on Logstash 9.5.5: 62 examples, 2 failures, 1 pending. Both failures (:932 unsupported client protocol message, :1083 cipher suites) also fail on unmodified 6.x on macOS because of local OpenSSL/JDK differences; they're unrelated.

🤖 Generated with Claude Code

get_port picked a random port in 10000..65535, checked it was free and
released it before the plugin bound it. Ports above 32767 are in the
kernel's ephemeral range, so in between another socket could be handed
the same port ("could not bind ... Address already in use").

Pick from 10000..32767 instead, below both the Linux (32768-60999) and
macOS (49152-65535) ephemeral ranges.

Equivalent of the main-branch fix in logstash-plugins#291, adapted to 6.x's get_port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Changelog and Version Management

No changelog or version changes detected. You can either update them manually or use a comment command to update them automatically on merge:

/pr_prepare release:<patch|minor|major> — bump version + update changelog
/pr_prepare changelog:add — changelog entry only (no version bump)

/pr_prepare release:patch
- Add the changelog entry here
  - (Additional details can be provided in multiple lines, respecting markdown formatting)

Omit the entry line to use the PR title. If multiple commands are posted, the last one wins.

@jsvd
jsvd merged commit a443098 into logstash-plugins:6.x Nov 4, 2026
13 checks passed
@jsvd
jsvd deleted the fix-flaky-port-allocation-spec-6.x branch November 4, 2026 12:17
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.

1 participant