moby / moby/hyperkit

Consider using kqueue in hypervisor socket implementation

Open
#211 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
3.7k
Forks
336
PR merge metrics
No merged PRs in 30d

Description

The core of hyperkit uses kqueue via mevent.c but pci_virtio_sock.c uses plain old select.

If hyperkit is used together with vpnkit in Docker for Mac and large numbers (> 1024) of connections are port forwarded then hyperkit becomes unable to process any more AF_VSOCK connections due to the accepted file descriptor being greater than FD_SETSIZE, see for example https://github.com/moby/hyperkit/blob/3ace9850121a2ef270e0309a3ff6c2f991357842/src/lib/pci_virtio_sock.c#L1364

This manifests as errors under load, for example

$ docker ps
Error response from daemon: Bad response from Docker engine

from https://github.com/docker/for-mac/issues/2841

This scalability limit could be removed by switching from select to kqueue (or poll) in pci_virtio_sock.c.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/lib/pci_virtio_sock.c around the select and accepted file-descriptor handling, then compare the event-management approach in mevent.c. Determine whether kqueue or poll is appropriate, preserve AF_VSOCK connection processing, and verify that descriptors above FD_SETSIZE can be handled under the reported connection load.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.