Ubuntu

Bug in Europe/Russia timezones

Reported by Dmitry Nesterov on 2011-10-05
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
tzdata (Ubuntu)
Undecided
Unassigned

Bug Description

In version tzdata-2011j (tzdata-2011k also affected) was founded strange bug in russian timezones.
Because of a law "On the Calculation of Time" there were changes in zone like:
3:00 Russia MSK/MSD 2011
changed to:
3:00 Russia MSK/MSD 2011 Mar 27 2:00s
4:00 - MSK
But if no rule used for this change (using "-" instead of rule "Russia"), calling of system function localtime_r() takes more time (takes more than 40% time longer).
I used following code for measuring:
==============================
#include <time.h>
#include <stdio.h>

int main() {
  time_t t = time(0);
  int i;
  struct tm result;
  for(i=0; i < 10000000; i++)
    localtime_r(&t, &result);
  puts(ctime(&t));
  return 0;
}
==============================
and also this sql code in mysql db:
select benchmark(1000000, from_unixtime(1317044847));
For example, when I'm using new tzdata-2011j results are:
1. time ./a.out (c code)
real 0m5.165s
user 0m5.140s
sys 0m0.000s
2. sql query
mysql> select benchmark(1000000, from_unixtime(1317044847));
+-----------------------------------------------+
| benchmark(1000000, from_unixtime(1317044847)) |
+-----------------------------------------------+
| 0 |
+-----------------------------------------------+
1 row in set (1.03 sec).
And when I'm using old tzdata-2008b:
1. time ./a.out (c code)
real 0m1.675s
user 0m1.450s
sys 0m0.000s
2. sql query
mysql> select benchmark(1000000, from_unixtime(1317044847));
+-----------------------------------------------+
| benchmark(1000000, from_unixtime(1317044847)) |
+-----------------------------------------------+
| 0 |
+-----------------------------------------------+
1 row in set (0.65 sec)

This bug seemed critical on high loaded systems (for example, for databases that using unix timestamps).

My configuration was:
Description: Ubuntu 8.04.1
Release: 8.04
Packages: 2011j~repack-0ubuntu0.8.04 and 2008b-1ubuntu1

The attachment "Difference that makes 2011 work better" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in tzdata (Ubuntu):
status: New → Confirmed
Dmitry Nesterov (keyd) wrote :

We have found that this bug occurs because of bug in glibc.
Version of glibc used: 2.7-10ubuntu3

The problem is that glibc uses function __tzfile_compute() if no rules are present in compiled binary zone file (usually, /etc/localtime).
If that occurs we may see while profiling (bad case):
samples % image name app name symbol name
63893 44.1876 libc-2.13.so libc-2.13.so _IO_vfscanf <-- this one
15824 10.9437 libc-2.13.so libc-2.13.so __offtime
7527 5.2056 libc-2.13.so libc-2.13.so __tzset_parse_tz
6295 4.3535 libc-2.13.so libc-2.13.so __strcmp_sse2
4781 3.3065 no-vmlinux no-vmlinux /no-vmlinux
4484 3.1011 libxul.so libxul.so /opt/firefox/libxul.so
3799 2.6273 libc-2.13.so libc-2.13.so ____strtoull_l_internal
3309 2.2885 libc-2.13.so libc-2.13.so compute_change
2803 1.9385 libc-2.13.so libc-2.13.so _IO_old_init
2317 1.6024 libc-2.13.so libc-2.13.so __tz_compute
2312 1.5989 libc-2.13.so libc-2.13.so _IO_str_init_static_internal
2225 1.5388 libc-2.13.so libc-2.13.so __tzfile_compute

When rules are present in compiled binary zone we have (good case):
samples % image name app name symbol name
15592 25.2322 libc-2.13.so libc-2.13.so __strcmp_sse2
10024 16.2216 no-vmlinux no-vmlinux /no-vmlinux
6336 10.2534 libc-2.13.so libc-2.13.so __offtime
5398 8.7355 libc-2.13.so libc-2.13.so __tzfile_compute
4961 8.0283 libc-2.13.so libc-2.13.so __tzstring
1361 2.2025 libc-2.13.so libc-2.13.so __tz_convert
1240 2.0067 libc-2.13.so libc-2.13.so __strlen_sse2
455 0.7363 test test main
253 0.4094 libc-2.13.so libc-2.13.so tzset_internal

Dmitry Nesterov (keyd) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers