From owner-freebsd-current@FreeBSD.ORG Wed Aug 29 23:37:09 2007 Return-Path: Delivered-To: Current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC37216A417 for ; Wed, 29 Aug 2007 23:37:09 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from creme-brulee.marcuscom.com (penna-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id 559F113C494 for ; Wed, 29 Aug 2007 23:37:09 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.1/8.14.1) with ESMTP id l7TNca6K088560 for ; Wed, 29 Aug 2007 19:38:36 -0400 (EDT) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: Current@FreeBSD.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-Q9M4Yz6ZCk0JHECVuSze" Organization: FreeBSD, Inc. Date: Wed, 29 Aug 2007 19:37:04 -0400 Message-Id: <1188430624.1077.21.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on creme-brulee.marcuscom.com Cc: Subject: VT_WAITACTIVE leads to unkillable processes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2007 23:37:09 -0000 --=-Q9M4Yz6ZCk0JHECVuSze Content-Type: text/plain Content-Transfer-Encoding: quoted-printable flz and I are working on a port of ConsoleKit to FreeBSD. ConsoleKit is a framework for tracking local users (i.e. users sitting at a machine) and their sessions. =20 Since it tracks local users and their consoles, it makes generous use of consio. One of the things it does is get a list of the total number of available consoles (i.e. vtys) and starts a thread for each one to check when the console becomes active. To do this, each thread invokes the VT_WAITACTIVE ioctl, and sits in waitvt until its vty becomes active. This works quite well. Where things break down is when the ConsoleKit daemon is stopped. When the daemon receives a signal, it immediately jumps to 100% of the CPU and claims to be in waitvt. It will not die unless you reboot the machine, or get lucky with the debugger. Below is a link to a small sample program that will reproduce this behavior. Simply compile the program, and run it from a vty other than 3 (ttyv2). Then try a control+C, and the problem will appear instantly. I've been testing 7.0-CURRENT #104: Thu Aug 16 16:54:28 EDT 2007 with ULE, but I have a report from flz that the same loop is observed on -STABLE with 4BSD. When I ran the test on -STABLE, my box immediately panicked, but I did not have dumps setup. Yes, this is a, "doctor it hurts when I do this" kind of thing; however, since this does not happen on Linux, I'm wondering if the kernel portion of the VT_WAITACTIVE ioctl can be modified not to cause this tight loop (or panic)? WARNING: This running this program will either cause instance on mostly unstoppable CPU load on your machine or panic it. http://www.marcuscom.com/downloads/vty.c gcc -o vty vty.c (switch to ttyv0) ./vty=20 Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-Q9M4Yz6ZCk0JHECVuSze Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQBG1gMbb2iPiv4Uz4cRArBRAJ9/5NvqyTyactTbpun5pqxKHVk7WwCeLsiG Ne5JJBvOWupK8uHR169gGGc= =fYlu -----END PGP SIGNATURE----- --=-Q9M4Yz6ZCk0JHECVuSze--