NetBSD Problem Report #47747
From www@NetBSD.org Wed Apr 17 16:03:07 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 4ABDE63EBD8
for <gnats-bugs@gnats.NetBSD.org>; Wed, 17 Apr 2013 16:03:07 +0000 (UTC)
Message-Id: <20130417160306.115DE63EBD8@www.NetBSD.org>
Date: Wed, 17 Apr 2013 16:03:05 +0000 (UTC)
From: tbrehm@dspace.de
Reply-To: tbrehm@dspace.de
To: gnats-bugs@NetBSD.org
Subject: TCP-based RPC client calls no longer terminate when connections break
X-Send-Pr-Version: www-1.0
>Number: 47747
>Category: lib
>Synopsis: TCP-based RPC client calls no longer terminate when connections break
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 17 16:05:00 +0000 2013
>Closed-Date: Sat Apr 12 19:25:50 +0000 2014
>Last-Modified: Sat Apr 12 19:25:50 +0000 2014
>Originator: Thorsten Brehm
>Release: NetBSD 6.0.1
>Organization:
dSPACE
>Environment:
>Description:
RPC client calls can block indefinitely when using TCP-based RPC connections. This happens when the network is interrupted or the remote server processes crashes while a RPC call is pending.
The problem exists since the following commit:
src/lib/libc/rpc/clnt_vc.c, version 1.18, 2012/03/13 21:13:44
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/rpc/clnt_vc.c?rev=1.18&content-type=text/x-cvsweb-markup&f=h
Version 1.17 still worked ok.
Diff:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/rpc/clnt_vc.c.diff?r1=1.17&r2=1.18&f=h
The problem is caused by the change in line 718, replacing
return len;
with
return (int) nread;
A few lines above, there is an error condition assigning
len = -1;
when detecting a "premature eof" error. Before, this caused "read_vc" to return -1 (=len) when the error was detected. Now it returns 0 (=nread) instead. Eventually this results in "clnt_call" blocking indefinitely since it keeps calling "read_vc" trying to grab all data - rather than aborting with a connection error.
Obvious fix: replace
len = -1;
with
return (-1);
to properly report the error.
Patch against latest trunk below.
>How-To-Repeat:
>Fix:
diff -wru trunk/clnt_vc.c fix/clnt_vc.c
--- original/lib/libc/rpc/clnt_vc.c Wed Apr 17 13:46:50 2013 UTC
+++ src/lib/libc/rpc/clnt_vc.c Mon Mar 11 20:19:29 2013 UTC
@@ -713,8 +713,7 @@
/* premature eof */
ct->ct_error.re_errno = ECONNRESET;
ct->ct_error.re_status = RPC_CANTRECV;
- len = -1; /* it's really an error */
- break;
+ return (-1); /* it's really an error */
case -1:
ct->ct_error.re_errno = errno;
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47747 CVS commit: src/lib/libc/rpc
Date: Wed, 17 Apr 2013 12:36:47 -0400
Module Name: src
Committed By: christos
Date: Wed Apr 17 16:36:47 UTC 2013
Modified Files:
src/lib/libc/rpc: clnt_vc.c
Log Message:
PR/47747: Thorsten Brehm: TCP-based RPC client calls no longer terminate when
connections break. Return proper error code.
XXX: pullup 6
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/rpc/clnt_vc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47747 CVS commit: [netbsd-6] src/lib/libc/rpc
Date: Sat, 20 Apr 2013 10:13:24 +0000
Module Name: src
Committed By: bouyer
Date: Sat Apr 20 10:13:23 UTC 2013
Modified Files:
src/lib/libc/rpc [netbsd-6]: clnt_vc.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #875):
lib/libc/rpc/clnt_vc.c: revision 1.22
PR/47747: Thorsten Brehm: TCP-based RPC client calls no longer terminate when
connections break. Return proper error code.
XXX: pullup 6
To generate a diff of this commit:
cvs rdiff -u -r1.17.8.2 -r1.17.8.3 src/lib/libc/rpc/clnt_vc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47747 CVS commit: [netbsd-6-0] src/lib/libc/rpc
Date: Sat, 20 Apr 2013 10:13:57 +0000
Module Name: src
Committed By: bouyer
Date: Sat Apr 20 10:13:57 UTC 2013
Modified Files:
src/lib/libc/rpc [netbsd-6-0]: clnt_vc.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #875):
lib/libc/rpc/clnt_vc.c: revision 1.22
PR/47747: Thorsten Brehm: TCP-based RPC client calls no longer terminate when
connections break. Return proper error code.
XXX: pullup 6
To generate a diff of this commit:
cvs rdiff -u -r1.17.12.1 -r1.17.12.2 src/lib/libc/rpc/clnt_vc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Sat, 12 Apr 2014 19:25:50 +0000
State-Changed-Why:
Fixed in HEAD, and netbsd-6 never had the issue.
Thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.