Re: script stuck in devdrn

From: Giorgos Keramidas <keramida_at_ceid.upatras.gr>
Date: Wed, 11 Apr 2007 14:23:53 +0300
On 2007-04-11 10:03, Dag-Erling Sm?rgrav <des_at_des.no> wrote:
> When I try to use script(1) on recent -CURRENT, it invariably gets
> stuck in devdrn upon exit, and not even SIGKILL will kill it.  I don't
> use it much, so I have no idea how long ago it broke.  Is anyone else
> seeing this?

Try turning off kern.pts.enable, or use the following patch to revert
one of the commits by tegge to `kern_conf.c':

%%%
# HG changeset patch
# User Giorgos Keramidas <keramida_at_ceid.upatras.gr>
# Date 1164424009 -7200
# Node ID 4d6784b6bd2b63fd7a8e235402c37f0edea6369f
# Parent  e4ce0f3f5ec51813ab4a590127484923437351e9
Locally revert cvs change 1.199 to src/sys/kern/kern_conf.c

This causes pty deallocation to hang forever with kern.pts.enable=1
which makes it pretty hard to work with anything that uses ptys,
like xterm, screen, script, etc.

diff -r e4ce0f3f5ec5 -r 4d6784b6bd2b sys/kern/kern_conf.c
--- a/sys/kern/kern_conf.c	Sat Nov 25 05:05:49 2006 +0200
+++ b/sys/kern/kern_conf.c	Sat Nov 25 05:06:49 2006 +0200
_at__at_ -676,7 +676,6 _at__at_ destroy_devl(struct cdev *dev)
 		dev->si_flags &= ~SI_CLONELIST;
 	}
 
-	dev->si_refcount++;	/* Avoid race with dev_rel() */
 	csw = dev->si_devsw;
 	dev->si_devsw = NULL;	/* already NULL for SI_ALIAS */
 	while (csw != NULL && csw->d_purge != NULL && dev->si_threadcount) {
_at__at_ -686,10 +685,6 _at__at_ destroy_devl(struct cdev *dev)
 			printf("Still %lu threads in %s\n",
 			    dev->si_threadcount, devtoname(dev));
 	}
-	while (dev->si_threadcount != 0) {
-		/* Use unique dummy wait ident */
-		msleep(&csw, &devmtx, PRIBIO, "devdrn", hz / 10);
-	}
 
 	dev->si_drv1 = 0;
 	dev->si_drv2 = 0;
_at__at_ -704,7 +699,6 _at__at_ destroy_devl(struct cdev *dev)
 			fini_cdevsw(csw);
 	}
 	dev->si_flags &= ~SI_ALIAS;
-	dev->si_refcount--;	/* Avoid race with dev_rel() */
 
 	if (dev->si_refcount > 0) {
 		LIST_INSERT_HEAD(&dead_cdevsw.d_devs, dev, si_list);
%%%

I know that Tor is working on a real fix for this, but reverting 1.199
stops pty-using processes from getting stuck forever in devdrn for me,
so I use it locally as a workaround until the real bug is fixed.

- Giorgos
Received on Wed Apr 11 2007 - 09:24:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:08 UTC