Date: Wed, 15 Jul 1998 22:26:43 -0500 (CDT) From: Jay Gramlich <jayg@fgi.net> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: ports/7295: Starting programs with bash port causes problems when openfiles is set high Message-ID: <199807160326.WAA11606@gramlich.dyn.ml.org>
next in thread | raw e-mail | index | archive | help
>Number: 7295 >Category: ports >Synopsis: Starting programs with bash port causes problems when openfiles is set high >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jul 15 20:50:01 PDT 1998 >Last-Modified: >Originator: Jay Gramlich >Organization: >Release: FreeBSD 2.2.6-RELEASE i386 >Environment: FreeBSD londo.gramlich.lan 2.2.6-RELEASE FreeBSD 2.2.6-RELEASE #0: Sat Jul 11 15:54:11 CDT 1998 root@londo.gramlich.lan:/usr/src/sys/compile/LONDO i386 >Description: When using bash as the running shell and openfiles is set to a large value (>258?) some programs (rxvt, eterm) fail on a select call and chew up cpu time and which makes them appear to not work. This only happens when starting the program using bash (not sh or csh) and happens with both bash 1.x and 2.x. The effect is listed in another pr concerning rxvt. I'm not sure if this is a bug in bash or if bash is tickling something else. >How-To-Repeat: login as a user with high openfile limits. Compile and run this program. ---cut--- #include <sys/types.h> #include <sys/time.h> #include <fcntl.h> #include <unistd.h> int main() { fd_set readfds; int retval; int fd; struct itimerval value; fd=open("/tmp/testselect",O_CREAT|O_RDWR, 0600); if (fd<0) exit(1); FD_ZERO(&readfds); FD_SET(fd,&readfds); value.it_value.tv_usec=0; value.it_value.tv_sec=1; retval=select(getdtablesize(), &readfds, NULL, NULL, &value.it_value); if (retval<0) perror("select"); printf("select returned: %i\n",retval); close(fd); unlink("/tmp/testselect"); exit(0); } ---cut--- When run under sh or csh the select call succeeds. Under bash it will fail with select:: Bad file descriptor select returned: -1 If you do a ulimit -n 258 - It works but with ulimit 259 it fail. >Fix: Don't use bash to start programs :-) >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807160326.WAA11606>