NetBSD Problem Report #37002

From martin@duskware.de  Tue Sep 18 16:18:00 2007
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 9CDF163B86C
	for <gnats-bugs@gnats.netbsd.org>; Tue, 18 Sep 2007 16:18:00 +0000 (UTC)
Message-Id: <20070918161529.0BE3E63B86C@narn.NetBSD.org>
Date: Tue, 18 Sep 2007 16:15:29 +0000 (UTC)
From: cheusov@tut.by
Reply-To: cheusov@tut.by
To: netbsd-bugs-owner@NetBSD.org
Subject: pkgtools/pbulk  libexec/scan utility fails on Linux
X-Send-Pr-Version: www-1.0

>Number:         37002
>Category:       pkg
>Synopsis:       pkgtools/pbulk  libexec/scan utility fails on Linux
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    joerg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 18 16:20:00 +0000 2007
>Closed-Date:    Sat Jan 26 00:35:18 +0000 2008
>Last-Modified:  Sat Jan 26 00:50:01 +0000 2008
>Originator:     Aleksey Cheusov
>Release:        Linux
>Organization:
home
>Environment:
Linux
>Description:
scan fails like this

pkgsrc-0:/# ( . /usr/pkg_pbulk/etc/pbulk.conf; /usr/pkg_pbulk/libexec/pbulk/scan; )
Scanning...
.................................................. 50/415
.................................................. 100/415
.................................................. 150/415
.................................................. 200/415
.................................................. 250/415
.................................................. 300/415
.................................................. 350/415
.................................................. 400/415
............... 415/415
Resolving...
Scanning...
pbulk-scan: Could not bind socket: Address already in use
pkgsrc-0:/#

This happens because bind(2) is called several times during a few seconds. Explanation is here  (item 3) http://www.ibm.com/developerworks/linux/library/l-sockpit/index.html
>How-To-Repeat:
master_mode=yes
limited_list=/not_empty_file

>Fix:
Index: files/pbulk/pscan/master.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pbulk/files/pbulk/pscan/master.c,v
retrieving revision 1.4
diff -u -r1.4 master.c
--- files/pbulk/pscan/master.c  21 Jul 2007 15:36:36 -0000      1.4
+++ files/pbulk/pscan/master.c  18 Sep 2007 16:12:30 -0000
@@ -204,6 +204,7 @@
        struct event listen_event;
        struct sockaddr_in dst;
        int fd;
+       int one = 1;

        LIST_INIT(&active_peers);
        LIST_INIT(&inactive_peers);
@@ -220,6 +221,8 @@
        if (ioctl(fd, FIOCLEX, NULL) == -1)
                err(1, "Could not set close-on-exec flag");
 #endif
+       if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof (one)) == -1)
+               err(1, "Could not setsockopt");
        if (bind(fd, (struct sockaddr *)&dst, sizeof(dst)) == -1)
                err(1, "Could not bind socket");
        if (listen(fd, 5) == -1)

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: obache@netbsd.org
Responsible-Changed-When: Wed, 19 Sep 2007 03:17:52 +0000
Responsible-Changed-Why:
Over to maintainer.


From: Tobias Nygren <tnn@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: cheusov@tut.by
Subject: Re: pkg/37002: pkgtools/pbulk  libexec/scan utility fails on Linux
Date: Wed, 23 Jan 2008 06:17:04 +0100

 On Tue, 18 Sep 2007 16:20:00 +0000 (UTC)
 cheusov@tut.by wrote:

 > pbulk-scan: Could not bind socket: Address already in use

 I have seen this on NetBSD also just now.
 Patch from the PR looks good to me, can we commit it?

 TIA,
 -Tobias

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/37002: pkgtools/pbulk  libexec/scan utility fails on Linux
Date: Wed, 23 Jan 2008 15:35:00 +0100

 On Wed, Jan 23, 2008 at 05:20:06AM +0000, Tobias Nygren wrote:
 >  > pbulk-scan: Could not bind socket: Address already in use
 >  
 >  I have seen this on NetBSD also just now.
 >  Patch from the PR looks good to me, can we commit it?

 I do not like this as it means it is much easier to accidently run the
 programs twice. This applies for pbulk-build as well.

 Joerg

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: joerg@NetBSD.org,  gnats-admin@netbsd.org,  pkgsrc-bugs@netbsd.org
Subject: Re: pkg/37002: pkgtools/pbulk  libexec/scan utility fails on Linux
Date: Wed, 23 Jan 2008 22:07:18 +0200

  >>  > pbulk-scan: Could not bind socket: Address already in use

  >>  I have seen this on NetBSD also just now.
  >>  Patch from the PR looks good to me, can we commit it?

 >  I do not like this as it means it is much easier to accidently run the
 >  programs twice. This applies for pbulk-build as well.

 This is not an argument at all.
 There are lots of ways to prevent prgram from running twice.

 -- 
 Best regards, Aleksey Cheusov.

State-Changed-From-To: open->closed
State-Changed-By: joerg@narn.netbsd.org
State-Changed-When: Sat, 26 Jan 2008 00:35:18 +0000
State-Changed-Why:
Fixed in pbulk-0.24 without breaking TCP.


From: Joerg Sonnenberger <joerg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/37002 CVS commit: pkgsrc/pkgtools/pbulk
Date: Sat, 26 Jan 2008 00:34:58 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	joerg
 Date:		Sat Jan 26 00:34:58 UTC 2008

 Modified Files:
 	pkgsrc/pkgtools/pbulk: Makefile
 	pkgsrc/pkgtools/pbulk/files/pbulk/pbuild: master.c
 	pkgsrc/pkgtools/pbulk/files/pbulk/pscan: master.c

 Log Message:
 pbulk-0.24:
 When all jobs are processed in master mode, close the listen socket
 and shutdown(2) all peers. Give them a second to close(2) the
 connection themselve, so that the port remains usable on the master.
 This is the standard compliant fix for PR 37002.


 To generate a diff of this commit:
 cvs rdiff -r1.30 -r1.31 pkgsrc/pkgtools/pbulk/Makefile
 cvs rdiff -r1.5 -r1.6 pkgsrc/pkgtools/pbulk/files/pbulk/pbuild/master.c
 cvs rdiff -r1.4 -r1.5 pkgsrc/pkgtools/pbulk/files/pbulk/pscan/master.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.