From nobody@FreeBSD.org  Sun Nov 13 16:06:24 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 58FF41065679
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Nov 2011 16:06:24 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 424388FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Nov 2011 16:06:24 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pADG6ODD074311
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 13 Nov 2011 16:06:24 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id pADG6Owg074310;
	Sun, 13 Nov 2011 16:06:24 GMT
	(envelope-from nobody)
Message-Id: <201111131606.pADG6Owg074310@red.freebsd.org>
Date: Sun, 13 Nov 2011 16:06:24 GMT
From: Stephen Sanders <ssanders@softhammer.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: OpenJDK 6 is not setting close on exec
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         162522
>Category:       java
>Synopsis:       OpenJDK 6 is not setting close on exec
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-java
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 13 16:10:09 UTC 2011
>Closed-Date:    Wed May 21 20:52:48 UTC 2014
>Last-Modified:  Wed May 21 20:52:48 UTC 2014
>Originator:     Stephen Sanders
>Release:        FreeBSD 8.1
>Organization:
OPNET
>Environment:
FreeBSD focus8.networkphysics.com 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
It appears that OpenJDK does not set close on exec for file handles where Diablo did.

If a process attempts to restart itself via fork/exec without closing all file handles first, it's child will fail with complaints of 'socket in use'.  Of course, this depends on what the child is doing.  Probably the best example is tomcat calling a shell script that restarts tomcat.

This issue is hinted at in the comments of

http://cr.openjdk.java.net/~ikrylov/6348631/src/os/linux/vm/os_linux.cpp.udiff.html
>How-To-Repeat:
Have tomcat exec a shell script that restarts tomcat.
>Fix:
Make sure the application closes all file handles before exec'ing a child.


>Release-Note:
>Audit-Trail:

From: Jung-uk Kim <jkim@FreeBSD.org>
To: freebsd-java@freebsd.org
Cc: Stephen Sanders <ssanders@softhammer.net>,
 freebsd-gnats-submit@freebsd.org
Subject: Re: java/162522: OpenJDK 6 is not setting close on exec
Date: Mon, 14 Nov 2011 13:05:47 -0500

 On Sunday 13 November 2011 11:06 am, Stephen Sanders wrote:
 > It appears that OpenJDK does not set close on exec for file handles
 > where Diablo did.
 >
 > If a process attempts to restart itself via fork/exec without
 > closing all file handles first, it's child will fail with
 > complaints of 'socket in use'.  Of course, this depends on what the
 > child is doing.  Probably the best example is tomcat calling a
 > shell script that restarts tomcat.
 
 This problem should have been fixed in b21_1.  However, it requires 
 fdescfs(5) as described in pkg-message.  Please check your 
 configurations.
 
 Jung-uk Kim
State-Changed-From-To: open->closed 
State-Changed-By: jkim 
State-Changed-When: Wed May 21 20:50:54 UTC 2014 
State-Changed-Why:  
This problem was fixed long time (~3 years) ago.  Closing. 

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