From langd@informatik.tu-muenchen.de  Thu Oct 18 04:35:17 2001
Return-Path: <langd@informatik.tu-muenchen.de>
Received: from mailout2.informatik.tu-muenchen.de (mailout2.informatik.tu-muenchen.de [131.159.254.8])
	by hub.freebsd.org (Postfix) with ESMTP id 536DC37B403
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Oct 2001 04:35:16 -0700 (PDT)
Received: from tuminfo2.informatik.tu-muenchen.de (tuminfo2.informatik.tu-muenchen.de [131.159.0.81])
	by mailout2.informatik.tu-muenchen.de (Postfix) with ESMTP id 47B2B8190
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Oct 2001 13:35:15 +0200 (MEST)
Received: from atrbg11.informatik.tu-muenchen.de (atrbg11.informatik.tu-muenchen.de [131.159.24.91])
	by tuminfo2.informatik.tu-muenchen.de (Postfix) with ESMTP id 137CC10AC1
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Oct 2001 13:35:13 +0200 (MEST)
Received: by atrbg11.informatik.tu-muenchen.de (Postfix, from userid 20455)
	id 17E531368D; Thu, 18 Oct 2001 13:35:15 +0200 (CEST)
Message-Id: <20011018113515.17E531368D@atrbg11.informatik.tu-muenchen.de>
Date: Thu, 18 Oct 2001 13:35:15 +0200 (CEST)
From: Daniel Lang <dl@leo.org>
Reply-To: Daniel Lang <dl@leo.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Netsaint check_by_ssh: fcntl(0, F_SETFL, O_NONBLOCK): Inappropriate ioctl for device 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31352
>Category:       ports
>Synopsis:       Netsaint check_by_ssh: fcntl(0, F_SETFL, O_NONBLOCK): Inappropriate ioctl for device
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 18 04:40:01 PDT 2001
>Closed-Date:    Tue Jun 11 01:18:04 PDT 2002
>Last-Modified:  Tue Jun 11 01:18:04 PDT 2002
>Originator:     Daniel Lang
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
TU Muenchen
>Environment:
System: FreeBSD atleo2.leo.org 4.4-STABLE FreeBSD 4.4-STABLE #3: Fri Oct 12 20:46:54 CEST 2001     root@atleo2.leo.org:/usr/obj/usr/src/sys/ATLEO2  i386

 - netsaint-0.0.7b6_1, cvsuped and built Oct 15 10:30
 - netsaint-plugins-1.2.9.4, cvsuped and built Oct 15 10:30
 - ssh: OpenSSH_2.9 FreeBSD localisations 20010713, SSH protocols 1.5/2.0, OpenSSL 0x0090601f

>Description:
 This could be more related to ssh, than to netsaint, but it seems to
 occur only if check_by_ssh is used. Unfortunately it is not really
 reproducable. Sometimes (like once a day) all remote checks that use
 ssh fail with that error message:
 
   fcntl(0, F_SETFL, O_NONBLOCK): Inappropriate ioctl for device

 They produce a warning, but fail 3 times, so no more checks are done, and
 I have to reschedule each check by hand, to get the state changed
 again. Then it works fine again for some hours.
 The problem did not occur before my update to 4.4-STABLE, and OpenSSH 2.9.
 I have to say, that there was ssh 2.9 installed on this system already
 (from the ports) before, but I guess there are differences to the one
 now included in the system.
 
>How-To-Repeat:
  Tricky: install netsaint and plugins, define a service which is checked
  on a remote machine, it doesn't seem to make difference which ssh 
  is used on the remote machine (I've had FreeBSD boxes and Solaris
  with different versions of OpenSSH). Start netsaint and wait until
  you get warnings about the checks failing with the error message above.
>Fix:

  sorry, no idea. Not beeing able to reproduce this problem in a defined
  environment, doesn't help. :(
>Release-Note:
>Audit-Trail:

From: Daniel Lang <dl@leo.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc: dl@leo.org
Subject: Re: ports/31352: Netsaint check_by_ssh: fcntl(0, F_SETFL, O_NONBLOCK): Inappropriate ioctl for device
Date: Thu, 18 Oct 2001 14:44:52 +0200

 Hi again,
 
 I can come up with some more info:
 
 - if netsaint reports the problem described, I can definitely
   do the check by hand, so even if I can submit something like
 
   /usr/local/libexec/netsaint/check_by_ssh -H some.host /usr/local/libexec/netsaint/check_disk 90 95 /
 
   it always works, by netsaint reports this problem.
 
 
 - A restart sometimes helps to solve the problem, but not for long
 
 - since fd 0 is stdin, I have the impression the I/O redirection
   between netsaint and it commands must try to set the pipe to
   O_NONBLOCK, but I couldn't find a piece of code, that does it.
   But I feel it, the problem must be somewhere within that, and
   maybe how ssh handles redirected i/o ?
 
 Best regards,
  Daniel
 -- 
 IRCnet: Mr-Spock   - signs of absurd developments in the net community: 
 #42:   - "Wurstbrot gehoert m.E. zum Fruehstuecks-botnet von Cartoon" -  
 *Daniel Lang * dl@leo.org * +49 89 289 25735 * http://www.leo.org/~dl/*

From: "Blaz Zupan" <blaz@amis.net>
To: <freebsd-gnats-submit@FreeBSD.org>, <dl@leo.org>
Cc:  
Subject: Re: ports/31352: Netsaint check_by_ssh: fcntl(0, F_SETFL, O_NONBLOCK): Inappropriate ioctl for device
Date: Tue, 11 Jun 2002 09:38:37 +0200

 Here is a patch for both the netsaint and nagios ports. Please report back
 if it fixes your problems.
 Fix has been pointed out to me by Stanley Hopcroft
 <Stanley.Hopcroft@IPAustralia.Gov.AU> (see PR 39018).
 
 diff -urN netsaint.old/Makefile netsaint/Makefile
 --- netsaint.old/Makefile Thu Mar 14 06:41:17 2002
 +++ netsaint/Makefile Tue Jun 11 09:25:40 2002
 @@ -7,6 +7,7 @@
 
  PORTNAME= netsaint
  PORTVERSION= 0.0.7
 +PORTREVISION= 1
  PORTEPOCH= 1
  CATEGORIES= net
  MASTER_SITES= http://netsaint.sourceforge.net/download/ \
 diff -urN netsaint.old/files/patch-ba netsaint/files/patch-ba
 --- netsaint.old/files/patch-ba Thu Jan  1 01:00:00 1970
 +++ netsaint/files/patch-ba Tue Jun 11 09:22:21 2002
 @@ -0,0 +1,20 @@
 +--- base/utils.c.orig Thu Feb 21 02:47:12 2002
 ++++ base/utils.c Tue Jun 11 09:21:53 2002
 +@@ -1884,6 +1884,17 @@
 +  val|=FD_CLOEXEC;
 +  fcntl(lockfile,F_SETFD,val);
 +
 ++ /* close existing stdin, stdout, stderr */
 ++ close(0);
 ++ close(1);
 ++ close(2);
 ++
 ++ /* THIS HAS TO BE DONE TO AVOID PROBLEMS WITH STDERR BEING REDIRECTED TO
 SERVICE MESSAGE PIPE! */
 ++ /* re-open stdin, stdout, stderr with known values */
 ++ open("/dev/null",O_RDONLY);
 ++ open("/dev/null",O_WRONLY);
 ++ open("/dev/null",O_WRONLY);
 ++
 +  return OK;
 +  }
 +
 
 diff -urN nagios.old/Makefile nagios/Makefile
 --- nagios.old/Makefile Tue Jun  4 04:52:36 2002
 +++ nagios/Makefile Tue Jun 11 09:10:31 2002
 @@ -6,11 +6,11 @@
  #
 
  PORTNAME= nagios
 -PORTVERSION= 1.0.b2
 +PORTVERSION= 1.0.b3
  CATEGORIES= net
  MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
  MASTER_SITE_SUBDIR=nagios
 -DISTNAME= nagios-1.0b2
 +DISTNAME= nagios-1.0b3
 
  MAINTAINER= blaz@si.FreeBSD.org
 
 diff -urN nagios.old/distinfo nagios/distinfo
 --- nagios.old/distinfo Tue Jun  4 04:52:36 2002
 +++ nagios/distinfo Tue Jun 11 09:10:47 2002
 @@ -1 +1 @@
 -MD5 (nagios-1.0b2.tar.gz) = beb6349b4ce46cd19e27a12ab1c79f70
 +MD5 (nagios-1.0b3.tar.gz) = 2bef463bedf547321d7eb6155355a389
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: kuriyama 
State-Changed-When: Tue Jun 11 01:17:49 PDT 2002 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31352 
>Unformatted:
