This is the mail archive of the
mailing list for the Cygwin project.
Re: BUG: Timezone failures with threads under Cygwin 1.5.25
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Cc: perl5-porters at perl dot org
- Date: Tue, 11 Dec 2007 16:02:47 +0100
- Subject: Re: BUG: Timezone failures with threads under Cygwin 1.5.25
- References: <email@example.com>
- Reply-to: cygwin at cygwin dot com, perl5-porters at perl dot org
On Dec 10 17:00, Jerry D. Hedden wrote:
> Under 1.5.24, this test always passes. Under 1.5.25, it is
> now frequently failing. If I add a debugging call in the
> central most loop:
> print("got: $lt exp: $localtime\n");
> I get the following as typical of the problem:
> 5 perl-current > ./perl -Ilib ext/threads/t/libc.t
> ok 1 - use threads
> got: Wed Dec 31 20:00:08 1969 exp: Wed Dec 31 19:00:08 1969
> This shows a 1 hour difference between the expected and
> actual results - which looks like a timezone issue.
> As the changes for 1.5.25 include numerous references to
> timezone handling changes, I suspect there may be some
> re-entrancy bug in those changes.
It would be more helpful if you would send self-contained code which
doesn't have to be tweaked to do a test. I'm not a perl developer, so
it took me some time to get it running. I'd also really prefer
testcases in plain C which I can simply run under GDB. Interpreter code
just adds unnecessary complexity.
I assume the perl libs are using localtime_r, right? Otherwise you
can't rely on reentrency nor thread-safety. Anyway, localtime is
supposed to be thread-safe in Cygwin.
The only change in 1.5.25 related to localtime is the fact that the
environment variable "TZ" is now left alone by Cygwin. Up to 1.5.24 the
function tzset() (called by localtime()) also sets the environment
variable "TZ", which is apparently incorrect according to POSIX. "TZ"
is used in later calls to decide whether some other code has to be run
And exactly that's the problem. Since TZ is now never set, that other
code, which is not thread-safe, is called much more frequent than
necessary. Actually it should only be called once per process, now it's
called once per invocation of tzset(). I've applied a patch to the 1.5.x
branch and will release an updated 1.5.25 in the next couple of days.
Thanks for the report,
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html