[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#417815: libc6: localtime dies with : tzfile.c:544: __tzfile_compute: Assertion `num_types == 1' failed



* Sven Luther:

> On Thu, Apr 05, 2007 at 08:46:08AM +0200, Florian Weimer wrote:
>> * Sven Luther:
>> 
>> > As said, i see this on both an x86 box and my powerbook, but the complete code
>> > is more involved, having a pselect, as well as a SIGALRM handler, which both
>> > trigger the localtime_r, as well as a postgresql access and files access.
>> 
>> localtime_r is not async-signal-safe, so this could be a bug in your
>> program.
>
> Ok, i will give a try of using just localtime.

localtime is not async-signal-safe, either.  A full list of such
functions is contained in the POSIX standard and probably the GNU libc
documentation as well.

> I thought it may be something such, but maybe the error message
> could be made something more explicit ?

You are asking for a general detection mechanism for race conditions,
which is not really feasible for production code.

> I guess the assertion is to check if more than one version of
> localtime_r is working then ?

If you invoke a function which is not async-signal-safe from a signal
handler, all bets are off.  That sanity check doesn't check for the
race condition, it merely catches the inconsistency caused by it (from
time to time).

(All this assumes that your bug is caused by improper use of a signal
handler.  Keep in mind that this is not necessarily the case.  But you
should fix that aspect of your code nevertheless.)



Reply to: