vpnkit icon indicating copy to clipboard operation
vpnkit copied to clipboard

caught Socket is not connected error

Open aemengo opened this issue 6 years ago • 3 comments

  • Operating System (Platform and Version): macOS High Sierra, version: 10.13.3
  • vpnkit: version: v0.2.0

When we look into the logs of our vpnkit configuration, we see the following line particularly often. Nothing is breaking necessarily but we'd just like to know if there's any need for alarm.

vpnkit: [ERROR] Socket.Stream: caught Socket is not connected
vpnkit: [ERROR] Socket.Stream: caught Socket is not connected

aemengo avatar Jun 06 '18 21:06 aemengo

@aemengo thanks for your report. I think I've seen this error a few times too and I think it's harmless. It comes from an exception handler around a connection callback. Probably the exception should be caught and the log suppressed. However before doing that I'd like to be able to reproduce the problem. I've tried a few things but no luck so far. Do you know how to reproduce this?

djs55 avatar Jun 22 '18 13:06 djs55

Apologies, but it also hard for me to give a streamlined reproduction example. Our setup is trying make networking work through 2+ levels of nested containerization, which might be the issue in and of itself.

aemengo avatar Jul 09 '18 16:07 aemengo

Sorry for the long delay on this. I was able to reproduce with the a linuxkit built VM with the following yaml.

kernel:
  image: linuxkit/kernel:4.14.63
  cmdline: "console=ttyS0 page_poison=1"
init:
  - linuxkit/vpnkit-expose-port:v0.6 # install vpnkit-expose-port and vpnkit-iptables-wrapper on host
  - linuxkit/init:v0.6
  - linuxkit/runc:v0.6
  - linuxkit/containerd:v0.6
onboot:
  - name: dhcpcd
    image: linuxkit/dhcpcd:v0.6
    command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
  - name: mount-vpnkit
    image: alpine:3.8
    binds:
        - /var/:/host_var:rbind,rshared
    capabilities:
        - CAP_SYS_ADMIN
    rootfsPropagation: shared
    command: ["sh", "-c", "mkdir /host_var/vpnkit && mount -v -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 port /host_var/vpnkit"]
services:
  - name: vpnkit-forwarder
    image: linuxkit/vpnkit-forwarder:v0.6
    binds:
        - /var/vpnkit:/port
    net: host
    command: ["/vpnkit-forwarder"]
  - name: expose-port
    image: alpine:3.6
    net: none
    binds:
      - /usr/bin/vpnkit-expose-port:/usr/bin/vpnkit-expose-port
      - /var/vpnkit:/port
    command: ["/usr/bin/vpnkit-expose-port","-i", "-no-local-ip",
              "-host-ip","127.0.0.1",
              "-host-port","10000",
              "-container-ip","127.0.0.1",
              "-container-port","10000"]

trust:
  org:
    - linuxkit

after running the VM built above, with the following command:

$ linuxkit build vpnkit-forwarder.yml
$ linuxkit run -networking vpnkit vpnkit-forwarder

The issue can repeatedly be seen by running the following on my host machine:

nc -v 127.0.0.1 10000

the vpnkit process invocation looks like this in the process list:

/usr/local/bin/vpnkit --ethernet fd:3 --vsock-path vpnkit-forwarder-state/connect --port fd:4

And version looks like:

$ /usr/local/bin/vpnkit --version
bbedcf42d9e6ba0afba65aca18dd5fc087192b13

aemengo avatar Aug 23 '18 20:08 aemengo