From nobody@FreeBSD.org  Fri Apr 10 13:43:21 2009
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 F0C63106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 10 Apr 2009 13:43:21 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id DF7E88FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 10 Apr 2009 13:43:21 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n3ADhKMm021151
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 10 Apr 2009 13:43:20 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n3ADhKAg021149;
	Fri, 10 Apr 2009 13:43:20 GMT
	(envelope-from nobody)
Message-Id: <200904101343.n3ADhKAg021149@www.freebsd.org>
Date: Fri, 10 Apr 2009 13:43:20 GMT
From: Oleg Ginzburg <oleg.ginzburg@nevosoft.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: audio/cdplay ports - bad behavior when cd drive is empty
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         133564
>Category:       ports
>Synopsis:       audio/cdplay ports - bad behavior when cd drive is empty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 10 13:50:01 UTC 2009
>Closed-Date:    Fri May 15 13:54:34 UTC 2009
>Last-Modified:  Fri May 15 13:54:34 UTC 2009
>Originator:     Oleg Ginzburg
>Release:        8.0-CURRENT
>Organization:
no company
>Environment:
FreeBSD oleg.net.nevosoft.ru 8.0-CURRENT FreeBSD 8.0-CURRENT #18 r190838M: Wed Apr  8 13:43:35 MSD 2009     root@oleg.net.nevosoft.ru:/usr/obj/usr/src/sys/o20090103  i386
>Description:
If execute cdplay -d <path_to_device> with empty cd-drive, system come to unstable
for "kern.maxfiles limit exceeded by uid NNNN, please see tuning(7)" reason.

If looks at this time through lsof(8) -p <PID_OF_CDPLAY> i see many repeating 

cdplay  27171 root *116r  VCHR   0,86              0t0       86 /dev/acd0

if connect to PID with truss:
truss -o /usr/out3.txt -p 27087

then examining /usr/out3.txt give looped messages:

..
nanosleep({2.000000000 })                        = 0 (0x0)
open("/dev/acd0",O_RDONLY,00)                    ERR#23 'Too many open files in system'
nanosleep({2.000000000 })                        = 0 (0x0)
open("/dev/acd0",O_RDONLY,00)                    ERR#23 'Too many open files in system'
nanosleep({2.000000000 })                        = 0 (0x0)
..

My CD-ROM hardware/vendor: DVDR <NEC DVD RW ND-3520A/1.04>
>How-To-Repeat:
Eject cdrom drive and remove any disc
cdplay -f /dev/acd (if acd0 - is correct cd drive) and watching.

>Fix:
IMHO needs some interval of seconds for attempts to open CD (if cdrom starts slowly) or error count and exit where num of errors overflow. Somewhere close to  69 strings of cd.c


..
/* Used to initalise cd */
void init_cd(void)
{
  struct ioc_read_toc_entry read_entry;
  struct cd_toc_entry toc_buffer[100];
  int i;

69:  while((cd_fd=open(cd_device,O_RDONLY))<0) sleep(2);

  cdinfo.eject=0;
..





>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: pav 
State-Changed-When: Thu Apr 30 11:13:55 UTC 2009 
State-Changed-Why:  
This port is unmaintained. Can you provide a patch? (Or can I suggest switching 
to cdcontrol(1) base system utility?) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133564 
State-Changed-From-To: feedback->closed 
State-Changed-By: pav 
State-Changed-When: Fri May 15 13:54:11 UTC 2009 
State-Changed-Why:  
No patch received 

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