Skip to content

fix(vsock): restore listener after accept#2434

Open
archevel wants to merge 3 commits into
hermit-os:mainfrom
archevel:fix-issue-with-vsock-accept
Open

fix(vsock): restore listener after accept#2434
archevel wants to merge 3 commits into
hermit-os:mainfrom
archevel:fix-issue-with-vsock-accept

Conversation

@archevel
Copy link
Copy Markdown

After accepting a connection, move the accepted socket to an ephemeral port and reset the listener entry to Listen state. Track the listen port separately in Socket so subsequent accept calls always find the listener entry regardless of how many connections have been accepted.

Fixes #2433

After accepting a connection, move the accepted socket to an ephemeral
port and reset the listener entry to Listen state. Track the listen port
separately in Socket so subsequent accept calls always find the listener
entry regardless of how many connections have been accepted.

Fixes hermit-os#2433
@archevel
Copy link
Copy Markdown
Author

As a reference I made this pull request as well with a regression test:
hermit-os/hermit-rs#996

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Details
Benchmark Current: 457df22 Previous: 1995748 Performance Ratio
startup_benchmark Build Time 96.85 s 97.26 s 1.00
startup_benchmark File Size 0.76 MB 0.76 MB 1.00
Startup Time - 1 core 0.80 s (±0.03 s) 0.81 s (±0.03 s) 0.98
Startup Time - 2 cores 0.80 s (±0.03 s) 0.81 s (±0.02 s) 0.99
Startup Time - 4 cores 0.81 s (±0.03 s) 0.82 s (±0.03 s) 0.99
multithreaded_benchmark Build Time 100.90 s 101.76 s 0.99
multithreaded_benchmark File Size 0.86 MB 0.86 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 68.15 % (±7.35 %) 66.91 % (±7.02 %) 1.02
Multithreaded Pi Efficiency - 4 Threads 42.33 % (±4.44 %) 41.78 % (±2.62 %) 1.01
Multithreaded Pi Efficiency - 8 Threads 20.77 % (±2.69 %) 20.03 % (±2.04 %) 1.04
micro_benchmarks Build Time 91.52 s 96.47 s 0.95
micro_benchmarks File Size 0.87 MB 0.87 MB 1.00
Scheduling time - 1 thread 71.73 ticks (±5.40 ticks) 71.35 ticks (±4.29 ticks) 1.01
Scheduling time - 2 threads 37.78 ticks (±3.55 ticks) 38.27 ticks (±4.80 ticks) 0.99
Micro - Time for syscall (getpid) 2.96 ticks (±0.25 ticks) 3.03 ticks (±0.33 ticks) 0.98
Memcpy speed - (built_in) block size 4096 79281.13 MByte/s (±54889.93 MByte/s) 75669.65 MByte/s (±52736.93 MByte/s) 1.05
Memcpy speed - (built_in) block size 1048576 29846.42 MByte/s (±24363.69 MByte/s) 29477.05 MByte/s (±24090.25 MByte/s) 1.01
Memcpy speed - (built_in) block size 16777216 28445.36 MByte/s (±23472.90 MByte/s) 25344.40 MByte/s (±21045.29 MByte/s) 1.12
Memset speed - (built_in) block size 4096 79540.14 MByte/s (±55056.02 MByte/s) 76041.75 MByte/s (±53007.66 MByte/s) 1.05
Memset speed - (built_in) block size 1048576 30592.64 MByte/s (±24803.22 MByte/s) 30224.16 MByte/s (±24517.62 MByte/s) 1.01
Memset speed - (built_in) block size 16777216 29217.52 MByte/s (±23926.42 MByte/s) 26091.14 MByte/s (±21520.38 MByte/s) 1.12
Memcpy speed - (rust) block size 4096 70027.07 MByte/s (±49237.04 MByte/s) 67847.73 MByte/s (±47702.41 MByte/s) 1.03
Memcpy speed - (rust) block size 1048576 29763.24 MByte/s (±24278.30 MByte/s) 29495.89 MByte/s (±24231.07 MByte/s) 1.01
Memcpy speed - (rust) block size 16777216 28623.00 MByte/s (±23620.51 MByte/s) 25761.59 MByte/s (±21357.10 MByte/s) 1.11
Memset speed - (rust) block size 4096 70113.20 MByte/s (±49295.01 MByte/s) 68063.04 MByte/s (±47855.91 MByte/s) 1.03
Memset speed - (rust) block size 1048576 30517.81 MByte/s (±24732.74 MByte/s) 30241.00 MByte/s (±24653.82 MByte/s) 1.01
Memset speed - (rust) block size 16777216 29404.03 MByte/s (±24078.32 MByte/s) 26436.66 MByte/s (±21756.66 MByte/s) 1.11
alloc_benchmarks Build Time 91.51 s 89.87 s 1.02
alloc_benchmarks File Size 0.84 MB 0.84 MB 1.00
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 10429.68 Ticks (±128.31 Ticks) 8684.14 Ticks (±133.75 Ticks) 1.20
Allocations - Average Allocation time (no fail) 10429.68 Ticks (±128.31 Ticks) 8684.14 Ticks (±133.75 Ticks) 1.20
Allocations - Average Deallocation time 830.69 Ticks (±157.27 Ticks) 776.46 Ticks (±122.30 Ticks) 1.07
mutex_benchmark Build Time 91.46 s 90.28 s 1.01
mutex_benchmark File Size 0.87 MB 0.87 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 13.22 ns (±0.94 ns) 13.08 ns (±0.98 ns) 1.01
Mutex Stress Test Average Time per Iteration - 2 Threads 15.68 ns (±1.09 ns) 16.84 ns (±8.53 ns) 0.93

This comment was automatically generated by workflow using github-action-benchmark.

@mkroening mkroening self-assigned this May 16, 2026
@mkroening mkroening self-requested a review May 16, 2026 17:06
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.

vsock listener cannot accept a second connection

2 participants