From owner-freebsd-bugs Fri Jun 13 15:18:44 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id PAA23748 for bugs-outgoing; Fri, 13 Jun 1997 15:18:44 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id PAA23447; Fri, 13 Jun 1997 15:07:33 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id OAA11667; Fri, 13 Jun 1997 14:59:37 -0700 From: Terry Lambert Message-Id: <199706132159.OAA11667@phaeton.artisoft.com> Subject: Re: (kern/3827) : was ASUS P/I-P65UP5 with C-P55T2D To: jin@george.lbl.gov (Jin Guojun[ITG]) Date: Fri, 13 Jun 1997 14:59:36 -0700 (MST) Cc: smp@csn.net, bugs@FreeBSD.ORG, smp@FreeBSD.ORG In-Reply-To: <199706132056.NAA22863@george.lbl.gov> from "Jin Guojun[ITG]" at Jun 13, 97 01:56:40 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > The problem has been narrowed to a very small program at below. > It appears to happen at subroutine level. That is, the open/freopn works > in main() program, but fails in subroutine. To replace the subroutine call > at line 7 in main(), marked /* replace HERE */, with the body of openread() , > then, program works. So, what can cause this problem? [ ... ] It's looks like you are hanging in the threads scheduler. When you butil your libraries, did you rebuild everything from scratch? If not, that may be your problem. I know that main is "different" in threads, but I don't understand why a subroutine call would cause it to fail when it doesn't fail in main. What happens if you link it without the threaded libc? Does it run OK? (Do you have one? Or are you running the very recently changed stuff?). If it does, there is apparently a hidden stack dependency bug which is being triggered by your code. Check the wrappers for the functions called by the functions you call. It may be that freopen() is not a happy camper in general, on the basis of descriptor locks, and you are only lucking out in main() when it works. Another thig to try is to take stdio out of the equation. I suspect that it is an implementation assumption in stdio that is biting you; it may in fact be a scheduler race which gets drawn out when you go down. If it's a race, make the variables global; if it still fails, you should then be able to migrate the code in and out of the subroutine a tine at a time to localise the error (part of this will be to compile the libc(3) pieces yourself, and migrate their function boundries as well). Sorry I can't give you an "oh, #define FROBOZZ" type soloution. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.