reassign 606618 libglib2.0-0 2.27.4-1 retitle 606618 glib2.0: g_timeout_add() cannot handle very large timeouts affects 606618 syslog-ng thanks
* Jakub Wilk <jw...@debian.org>, 2010-12-10, 13:36:
I have "stats_freq(86400)" in my syslog-ng.conf, and it used to work fine until I upgraded libglib2.0-0 from 2.24.2-1 to 2.27.4-1. Apparently statistics are now logged every 8m30s (rather than every 24h, as I requested).
I turns out this is a bug in glib. The attached minimal test program should go ping every ~24 hours, and it apparently does with glib 2.24.2-1, but not with 2.27.4-1:
$ gcc -Wall -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include/ test.c -o test -lglib-2.0 $ ./test Ping interval: 85900.00 s PING (0.66 s) PING (0.66 s) PING (0.66 s) [...and so on...] -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (990, 'unstable'), (500, 'experimental'), (500, 'testing') Architecture: i386 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores) Locale: LANG=C, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libglib2.0-0 depends on: ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib ii libpcre3 8.02-1.1 Perl 5 Compatible Regular Expressi ii libselinux1 2.0.96-1 SELinux runtime shared libraries ii zlib1g 1:1.2.5.dfsg-1 compression library - runtime Versions of packages libglib2.0-0 recommends: pn libglib2.0-data <none> (no description available) ii shared-mime-info 0.80-2 FreeDesktop.org shared MIME databa -- Jakub Wilk
#include <glib.h> #include <glib/gprintf.h> #include <sys/time.h> gint64 get_real_time() { struct timeval tv; gettimeofday(&tv, NULL); return (((gint64) tv.tv_sec) * 1000000) + tv.tv_usec; } static const guint interval = 85900000 /* 23h 51m 40s */; static gint64 last_ping; static GMainLoop *main_loop = NULL; gboolean ping(gpointer st) { gint64 now = get_real_time(); g_printf("PING (%.2f s)\n", (now - last_ping) / 1.0e6); last_ping = now; return TRUE; } int main(int argc, char **argv) { g_printf("Ping interval: %.2f s\n", interval / 1.0e3); last_ping = get_real_time(); main_loop = g_main_loop_new(NULL, FALSE); g_timeout_add(interval, ping, NULL); g_main_loop_run(main_loop); return 0; } // vim:ts=4 sw=4 et