Skip to content

fix(vsock): restore listener after accept#2434

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

fix(vsock): restore listener after accept#2434
archevel wants to merge 4 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: 1f35b4d Previous: ede71c0 Performance Ratio
startup_benchmark Build Time 106.83 s 99.20 s 1.08
startup_benchmark File Size 0.76 MB 0.76 MB 1.00
Startup Time - 1 core 0.93 s (±0.05 s) 0.94 s (±0.04 s) 1.00
Startup Time - 2 cores 0.93 s (±0.03 s) 0.96 s (±0.05 s) 0.98
Startup Time - 4 cores 0.94 s (±0.05 s) 0.96 s (±0.04 s) 0.98
multithreaded_benchmark Build Time 105.65 s 107.20 s 0.99
multithreaded_benchmark File Size 0.86 MB 0.86 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 88.39 % (±16.76 %) 91.00 % (±14.55 %) 0.97
Multithreaded Pi Efficiency - 4 Threads 44.24 % (±8.32 %) 45.27 % (±7.73 %) 0.98
Multithreaded Pi Efficiency - 8 Threads 24.16 % (±4.14 %) 24.88 % (±3.26 %) 0.97
micro_benchmarks Build Time 87.17 s 92.81 s 0.94
micro_benchmarks File Size 0.86 MB 0.86 MB 1.00
Scheduling time - 1 thread 69.29 ticks (±4.14 ticks) 68.53 ticks (±3.92 ticks) 1.01
Scheduling time - 2 threads 38.91 ticks (±3.99 ticks) 39.67 ticks (±4.24 ticks) 0.98
Micro - Time for syscall (getpid) 2.94 ticks (±0.26 ticks) 2.95 ticks (±0.28 ticks) 1.00
Memcpy speed - (built_in) block size 4096 77793.35 MByte/s (±53840.90 MByte/s) 79590.12 MByte/s (±55157.77 MByte/s) 0.98
Memcpy speed - (built_in) block size 1048576 30054.09 MByte/s (±24484.20 MByte/s) 29900.58 MByte/s (±24427.92 MByte/s) 1.01
Memcpy speed - (built_in) block size 16777216 29179.81 MByte/s (±24110.34 MByte/s) 29198.54 MByte/s (±24141.87 MByte/s) 1.00
Memset speed - (built_in) block size 4096 77641.21 MByte/s (±53728.07 MByte/s) 79808.67 MByte/s (±55316.96 MByte/s) 0.97
Memset speed - (built_in) block size 1048576 30774.70 MByte/s (±24894.33 MByte/s) 30660.50 MByte/s (±24865.67 MByte/s) 1.00
Memset speed - (built_in) block size 16777216 29944.98 MByte/s (±24548.10 MByte/s) 29947.79 MByte/s (±24563.56 MByte/s) 1.00
Memcpy speed - (rust) block size 4096 70159.77 MByte/s (±49020.08 MByte/s) 71838.02 MByte/s (±50156.20 MByte/s) 0.98
Memcpy speed - (rust) block size 1048576 29893.86 MByte/s (±24399.53 MByte/s) 29850.23 MByte/s (±24412.52 MByte/s) 1.00
Memcpy speed - (rust) block size 16777216 29188.93 MByte/s (±24101.30 MByte/s) 29179.09 MByte/s (±24119.28 MByte/s) 1.00
Memset speed - (rust) block size 4096 70805.92 MByte/s (±49482.65 MByte/s) 72078.48 MByte/s (±50299.01 MByte/s) 0.98
Memset speed - (rust) block size 1048576 30663.02 MByte/s (±24843.89 MByte/s) 30581.94 MByte/s (±24812.57 MByte/s) 1.00
Memset speed - (rust) block size 16777216 29971.05 MByte/s (±24552.02 MByte/s) 29935.12 MByte/s (±24543.49 MByte/s) 1.00
alloc_benchmarks Build Time 84.93 s 85.84 s 0.99
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 4510.27 Ticks (±51.36 Ticks) 4581.75 Ticks (±1166.54 Ticks) 0.98
Allocations - Average Allocation time (no fail) 4510.27 Ticks (±51.36 Ticks) 4581.75 Ticks (±1166.54 Ticks) 0.98
Allocations - Average Deallocation time 1089.43 Ticks (±72.07 Ticks) 878.84 Ticks (±180.10 Ticks) 1.24
mutex_benchmark Build Time 84.85 s 101.79 s 0.83
mutex_benchmark File Size 0.87 MB 0.87 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 12.74 ns (±0.82 ns) 13.22 ns (±0.73 ns) 0.96
Mutex Stress Test Average Time per Iteration - 2 Threads 16.72 ns (±8.64 ns) 19.06 ns (±1.33 ns) 0.88

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
@archevel archevel force-pushed the fix-issue-with-vsock-accept branch from 457df22 to 1391ad4 Compare May 28, 2026 09:16
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