kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Network hangs when communicating with host
@ 2015-10-15 20:20 Dmitry Vyukov
  2015-10-16 17:25 ` Sasha Levin
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Vyukov @ 2015-10-15 20:20 UTC (permalink / raw)
  To: levinsasha928, Pekka Enberg, asias.hejun, penberg, gorcunov,
	Will Deacon, andre.przywara, matt, michael, prasadjoshi124,
	Sasha Levin, marc.zyngier, Aneesh Kumar K.V, mingo, gorcunov
  Cc: kvm, Kostya Serebryany, Evgenii Stepanov, Alexey Samsonov,
	Alexander Potapenko, syzkaller

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

Hello,

I am trying to run a program in lkvm sandbox so that it communicates
with a program on host. I run lkvm as:

./lkvm sandbox --disk sandbox-test --mem=2048 --cpus=4 --kernel
/arch/x86/boot/bzImage --network mode=user -- /my_prog

/my_prog then connects to a program on host over a tcp socket.
I see that host receives some data, sends some data back, but then
my_prog hangs on network read.

To localize this I wrote 2 programs (attached). ping is run on host
and pong is run from lkvm sandbox. They successfully establish tcp
connection, but after some iterations both hang on read.

Networking code in Go runtime is there for more than 3 years, widely
used in production and does not have any known bugs. However, it uses
epoll edge-triggered readiness notifications that known to be tricky.
Is it possible that lkvm contains some networking bug? Can it be
related to the data races in lkvm I reported earlier today?

I am on commit 3695adeb227813d96d9c41850703fb53a23845eb.

Thank you

[-- Attachment #2: pong.go --]
[-- Type: text/x-go, Size: 462 bytes --]

package main

import (
	"log"
	"net"
)

func main() {
	c, err := net.Dial("tcp", "192.168.33.1:39921")
	if err != nil {
		log.Fatalf("failed to dial: %v", err)
	}
	log.Printf("connected")
	for {
		var buf [1]byte
		n, err := c.Write(buf[:])
		if err != nil || n != 1 {
			log.Fatalf("failed to write: %v", err)
		}
		log.Printf("write")
		n, err = c.Read(buf[:])
		if err != nil || n != 1 {
			log.Fatalf("failed to read: %v", err)
		}
		log.Printf("read")
	}
}

[-- Attachment #3: ping.go --]
[-- Type: text/x-go, Size: 574 bytes --]

package main

import (
	"log"
	"net"
)

func main() {
	ln, err := net.Listen("tcp", "127.0.0.1:39921")
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	log.Printf("listening")
	c, err := ln.Accept()
	if err != nil {
		log.Fatalf("failed to accept: %v", err)
	}
	log.Printf("connected")
	for {
		var buf [1]byte
		n, err := c.Read(buf[:])
		if err != nil || n != 1 {
			log.Fatalf("failed to read: %v", err)
		}
		log.Printf("read")
		n, err = c.Write(buf[:])
		if err != nil || n != 1 {
			log.Fatalf("failed to write: %v", err)
		}
		log.Printf("write")
	}
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-27  9:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 20:20 Network hangs when communicating with host Dmitry Vyukov
2015-10-16 17:25 ` Sasha Levin
     [not found]   ` <CACT4Y+bG3gZv7eBUg5hv=5CEasdGUHwYEe6Bae6OVMK3bZe1Rw@mail.gmail.com>
2015-10-19  9:22     ` Andre Przywara
2015-10-19  9:28       ` Dmitry Vyukov
2015-10-19 14:20         ` Sasha Levin
2015-10-20 13:42           ` Dmitry Vyukov
2015-10-20 13:58             ` Sasha Levin
2015-10-27  9:31               ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).