Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Sep 98 06:51:02 -0500
From:      "Richard Seaman, Jr." <lists@tar.com>
To:        "HighWind Software Information" <info@highwind.com>
Cc:        "freebsd-current@FreeBSD.ORG" <freebsd-current@FreeBSD.ORG>
Subject:   Re: libc_r trouble and free() called recursively
Message-ID:  <199809081151.GAA10364@ns.tar.com>

next in thread | raw e-mail | index | archive | help
On Mon, 7 Sep 1998 17:15:04 -0400 (EDT), HighWind Software Information wrote:

>
>   >How bad is it to get this:
>   >	"t_activefile in free(): warning: recursive call."
>
>   bad.  It means that you're trying to malloc in a signal handler
>   (99.9% of the cases), which isn't really allowed...
>
>I agree. That is a bad thing to do. I just wish the program in question
>HAD a signal handler. The only "signal handling" going on would be inside
>libc_r.a.
>
>A quick grep of /usr/src/lib/libc_r/*/*.c CERTAINLY shows "malloc()"
>being called. However, I don't know much about when libc_r code runs.
>Does this sound like something that could happen?
>
>Now I'm getting very worried!

The pthread scheduler, _thread_kern_sched can get called two ways:

1) When a thread blocks, or

2) When a thread is interrupted by a SIGVTALRM

The first thing the scheduler does is check for "dead threads", and
cleans them up if it finds them, calling free() in the process.

Your previous kernel logs suggest that _thread_kern_sched is called
from a SIGVTALRM shortly before it stalls in the accept call.  If
"dead threads" are processed during this call to _thread_kern_sched
you will get a call to free() during the signal handling of SIGVTALRM.

I can't explain why you hang at the accept call, nor necessarily why
you get "t_activefile in free(): warning: recursive call."  However,
this would at least explain why you get a free() in a signal handler.

Possibly there is a problem in the thread exit and clean up handling,
either in your source, or in the pthread library.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809081151.GAA10364>