From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH] vhost: fix connect hang in client mode Date: Thu, 21 Jul 2016 17:37:14 +0800 Message-ID: <20160721093714.GD28708@yliu-dev.sh.intel.com> References: <1469089275-15209-1-git-send-email-i.maximets@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, Huawei Xie , Dyasly Sergey , Heetae Ahn , Thomas Monjalon To: Ilya Maximets Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4D8553237 for ; Thu, 21 Jul 2016 11:33:09 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1469089275-15209-1-git-send-email-i.maximets@samsung.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Jul 21, 2016 at 11:21:15AM +0300, Ilya Maximets wrote: > If something abnormal happened to QEMU, 'connect()' can block calling > thread (e.g. main thread of OVS) forever or for a really long time. > This can break whole application or block the reconnection thread. > > Example with OVS: > > ovs_rcu(urcu2)|WARN|blocked 512000 ms waiting for main to quiesce > (gdb) bt > #0 connect () from /lib64/libpthread.so.0 > #1 vhost_user_create_client (vsocket=0xa816e0) > #2 rte_vhost_driver_register > #3 netdev_dpdk_vhost_user_construct > #4 netdev_open (name=0xa664b0 "vhost1") > [...] > #11 main > > Fix that by setting non-blocking mode for client sockets for connection. > > Fixes: 64ab701c3d1e ("vhost: add vhost-user client mode") Thanks for spotting and fixing yet another bug! > > +static int > +vhost_user_connect_nonblock(int fd, struct sockaddr *un, size_t sz) I don't quite understand why this is needed: connect() with O_NONBLOCK flag set is not enough? --yliu