Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#287 Conky: can't select(): Invalid argument

open
nobody
Code (277)
5
2012-01-03
2010-03-14
Cesare Tirabassi
No

Discussion

  • balta2ar
    balta2ar
    2011-08-31

    I confirm the problem.

    I have managed to discover that update_interval parameter causes this problem for me. The minimal value is 2148 which causes a lot of "Conky: can't select(): Invalid argument" messages to appear. However, it does not cause high CPU usage for long.

    In order to load CPU really intensively, put bigger number in update_interval. 3600 does the job for me. Here is a minimal config which causes 100% CPU usage:

    $ cat high-cpu-usage-minimal.conf
    update_interval 3600
    TEXT

    I'm using ArchLinux.

    $ conky -v
    Conky 1.8.1 compiled Sat Apr 9 10:24:30 UTC 2011 for Linux 2.6.38-ARCH (i686)

    Compiled in features:

    System config file: /etc/conky/conky.conf
    Package library path: /usr/lib/conky

    X11:
    * Xdamage extension
    * XDBE (double buffer extension)
    * Xft
    * ARGB visual

    Music detection:
    * MPD
    * MOC

    General:
    * math
    * hddtemp
    * portmon
    * Curl
    * RSS
    * Weather (METAR)
    * Weather (XOAP)
    * wireless
    * support for IBM/Lenovo notebooks
    * config-output
    * Imlib2
    * apcupsd
    * iostats
    * ncurses

    According to PKGBUILD conky is configured with agruments as follows:
    ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --enable-ibm \ --enable-curl \ --enable-rss \ --enable-weather-xoap \ --enable-imlib2 \ --disable-lua \ --enable-wlan \

    Also, current-power.patch is applied:
    patch -p1 < ../current-power.patch # See FS#21984

    $ yaourt -Qi conky
    Name : conky
    Version : 1.8.1-3
    URL : http://conky.sourceforge.net/
    Licenses : custom
    Groups : None
    Provides : None
    Depends On : alsa-lib libxml2 curl wireless_tools libxft glib2 libxdamage imlib2
    Optional Deps : None
    Required By : None
    Conflicts With : None
    Replaces : torsmo
    Installed Size : 372.00 K
    Packager : Gaetan Bisson <bisson@archlinux.org>
    Architecture : i686
    Build Date : Sat 09 Apr 2011 02:24:44 PM MSK
    Install Date : Wed 31 Aug 2011 01:15:58 PM MSK

    Versions of conky's dependencies: http://pastie.org/private/arwt5tgzmztgfqgvtukudw

     
  • balta2ar
    balta2ar
    2011-08-31

    The problem was with tv_usec field of the timeval struct. Values of update_interval higher than 2147 caused t * 1000000 to overflow the maximum value of long type on x86 architectures. The way I fixed that is probably not elegant but the point is clear.

    Here is a patch which fixes the problem (http://pastie.org/private/wrfigmqzmffwlx7nxqa9ma):

    ## update_interval.patch [diff]
    diff -r b43b145d72f2 src/conky.c
    --- a/src/conky.c Wed Aug 31 14:02:00 2011 +0300
    +++ b/src/conky.c Wed Aug 31 14:10:07 2011 +0300
    @@ -3564,17 +3564,18 @@ static void main_loop(void)

    if (t < 0) {
    t = 0;
    } else if (t > update_interval) {
    t = update_interval;
    }

    tv.tv_sec = (long) t;
    - tv.tv_usec = (long) (t * 1000000) % 1000000;
    + // t * 10 ^ 6 will overflow if t > 2147, so we limit it explicitly
    + tv.tv_usec = (long) ((t > 2147 ? 2147 : t) * 1000000) % 1000000;
    FD_ZERO(&fdsr);
    FD_SET(ConnectionNumber(display), &fdsr);

    s = select(ConnectionNumber(display) + 1, &fdsr, 0, 0, &tv);
    if (s == -1) {
    if (errno != EINTR) {
    NORM_ERR("can't select(): %s", strerror(errno));
    }

    Another patch was required to build conky -- curl library removed deprecated include files which are used by conky:
    http://pastie.org/private/uet5hdbsnh6xzw4tk8iow

     
  • pavelo
    pavelo
    2011-09-17

    • status: open --> closed-fixed
     
  • pavelo
    pavelo
    2011-09-17

    Thanks for the report to both of you.
    The fix for this is in git and will appear in the next release. You are welcome to test it and report back if it does not fix your problem.

     
  • Vincent C.
    Vincent C.
    2011-12-18

    I've applied the patch for this bug (http://git.omp.am/?p=conky.git;a=patch;h=c9a306defd1f2f04af99320a02a4a27062f59328) in the Debian/Ubuntu conky package, but it seems to have introduced a few regressions.

    http://bugs.debian.org/652336
    http://bugs.debian.org/652536

    (I'm not very familiar with SF's bug tracker, but I can't seem to find a way to re-open this bug report, or otherwise mark it as not fixed.)

     
  • pavelo
    pavelo
    2012-01-03

    • status: closed-fixed --> open