NetBSD Problem Report #58234

From www@netbsd.org  Wed May  8 11:34:44 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D908C1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  8 May 2024 11:34:43 +0000 (UTC)
Message-Id: <20240508113442.5C5021A923B@mollari.NetBSD.org>
Date: Wed,  8 May 2024 11:34:42 +0000 (UTC)
From: aharen@jprs.co.jp
Reply-To: aharen@jprs.co.jp
To: gnats-bugs@NetBSD.org
Subject: devel/libuv: uv_tcp_close_reset() needs to handle some additional errno on NetBSD
X-Send-Pr-Version: www-1.0

>Number:         58234
>Category:       pkg
>Synopsis:       devel/libuv: uv_tcp_close_reset() needs to handle some additional errno on NetBSD
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 08 11:35:00 +0000 2024
>Last-Modified:  Fri May 10 06:30:03 +0000 2024
>Originator:     Yoshitaka Aharen
>Release:        pkgsrc-2024Q1
>Organization:
>Environment:
NetBSD i-07c93585682bdf6ff.ap-northeast-1.compute.internal 9.3_STABLE NetBSD 9.3_STABLE (GENERIC64) #0: Sat Apr  1 16:28:55 UTC 2023  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
>Description:
uv_tcp_close_reset() needs to handle some additional errno other than EINVAL on NetBSD.

https://github.com/libuv/libuv/blob/v1.48.0/src/unix/tcp.c#L399-L408

uv_tcp_close_reset() sets SO_LINGER then call uv_close().
If errno set in setsockopt() is EINVAL, it is converted to 0 then uv_close() is called.

While the man page tells different from the implementation, setsockopt() on NetBSD can return the other errno's which is better to be ignored in some situations (ECONNRESET, etc).  It is not the case in other operating systems.

A caller of uv_tcp_close_reset() needs to check the return value and call uv_close() by hand if it encounters such errno's.  As EINVAL (the socket has been shut down already) is handled explicitly, it would be better to also handle ECONNRESET (the socket has been reset by the remote) or such soft-failures gracefully.
>How-To-Repeat:

>Fix:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/58234: devel/libuv: uv_tcp_close_reset() needs to handle
 some additional errno on NetBSD
Date: Wed, 8 May 2024 13:36:55 +0200

 Can you please report this upstream?

 Thanks,
  Thomas

From: Yoshitaka Aharen <aharen@jprs.co.jp>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org,
 gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org
Subject: Re: pkg/58234: devel/libuv: uv_tcp_close_reset() needs to handle some additional errno on NetBSD
Date: Fri, 10 May 2024 15:25:09 +0900

 Hello,

 Thank you for your response.  I'll report it to the upstream.

 Do you have any suggestions on which errnos better to be ignored?
 Everything in DIAGNOSTICS section in tcp(4) would be excessive.
 ETIMEDOUT and ECONNRESET would be an option.

 Best Regards,


 -- 
 Yoshitaka Aharen <aharen@jprs.co.jp>
 Japan Registry Services Co., Ltd.


 On Wed,  8 May 2024 11:40:02 +0000 (UTC)
 Thomas Klausner <wiz@NetBSD.org> wrote:

 > The following reply was made to PR pkg/58234; it has been noted by GNATS.
 > 
 > From: Thomas Klausner <wiz@NetBSD.org>
 > To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
 > Cc: 
 > Subject: Re: pkg/58234: devel/libuv: uv_tcp_close_reset() needs to handle
 >  some additional errno on NetBSD
 > Date: Wed, 8 May 2024 13:36:55 +0200
 > 
 >  Can you please report this upstream?
 >  
 >  Thanks,
 >   Thomas
 >  

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.