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

Close

#500 liferea keeps waking up the cpu a lot

closed-fixed
nobody
None
5
2007-06-19
2007-05-13
Brian Pepple
No

From:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239945

Description of problem:
/* setup the processing of feed update results */
g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE,
100,
update_dequeue_results,
NULL,
NULL);

this code sets a.. 100 miliseconds timer to look at a queue which will be empty most of the time.

timer should only be set if there's actually anything in the queue...

Discussion

  • Brian Pepple
    Brian Pepple
    2007-05-13

    Patch to fix 100ms timer

     
    Attachments
  • Brian Pepple
    Brian Pepple
    2007-05-13

    Logged In: YES
    user_id=952951
    Originator: YES

    The patch attached fixes the 100ms timer. There's still at least one
    once-per-second timer left that also wants fixing; but the 100ms one is a good
    start to get fixed soon.
    File Added: liferea.patch

     
  • Lars Windolf
    Lars Windolf
    2007-05-13

    Logged In: YES
    user_id=834800
    Originator: NO

    Patch merged against 1.2.x and 1.3.x sources. I agree with changing the 100ms timer, but I do not with the second 1000ms which is only called rarely (after HTTP errors) to allow 3 retries per request. So it is not continuous timer and should cause not much load.

    BTW: I also removed the initial timer setup in update_init() which is not necessary with the patch anymore (and is not removed by the patch).

     
  • Lars Windolf
    Lars Windolf
    2007-05-13

    • status: open --> open-fixed
     
  • Bret Towe
    Bret Towe
    2007-05-14

    Logged In: YES
    user_id=300880
    Originator: NO

    on a side note couldn't the default timer for feed refresh be increased to like 10 seconds?
    if the minimum feed refresh rate is 1 minute there isn't much need for 1 second resolution

     
  • Lars Windolf
    Lars Windolf
    2007-05-15

    Logged In: YES
    user_id=834800
    Originator: NO

    > in feedlist.c I see in 1.2.10 at least is
    > (void)g_timeout_add(1000, feedlist_auto_update, NULL);

    A misunderstanding I thought the second timer in
    src/update.c was in question...

    > using g_timeout_add isn't the way to go

    Well g_timeout_add_seconds() is glib 2.14.x, therefore
    I, running Debian Unstable, cannot use it yet. Therefore
    this is the way to go for some more time :-)

    Now for your question on having larger interval for
    the feed refresh timer. It is not possible because some
    of the processed requests are directly user generated.
    And to have the user wait 10s just for the update is
    requested is not an option.

     
  • Lars Windolf
    Lars Windolf
    2007-05-17

    Logged In: YES
    user_id=834800
    Originator: NO

    Solution released with 1.2.15

    I'll leave the bug open until I can change the other relevant timer to g_timeout_add_seconds().

     
  • Bret Towe
    Bret Towe
    2007-05-19

    Logged In: YES
    user_id=300880
    Originator: NO

    12.3% (111.4) liferea-bin : schedule_timeout (process_timeout)

    1.2.10

    9.4% (102.0) liferea-bin : schedule_timeout (process_timeout)

    1.2.15

    better by a bit but still waking alot

     
  • jtjt
    jtjt
    2007-06-03

    Logged In: YES
    user_id=1622838
    Originator: NO

    It's not so bad for me:
    51.8% (58.2) liferea-bin : schedule_timeout (process_timeout)
    Anyway it's still lots of interruptions.

    When I run strace -tt -p $(pid), I can see:
    19:33:49.999979 futex(0x8100528, FUTEX_WAKE, 1) = 0
    19:33:50.000182 gettimeofday({1180892030, 263}, NULL) = 0
    19:33:50.000349 clock_gettime(CLOCK_REALTIME, {1180892030, 396757}) = 0
    19:33:50.000429 futex(0x8103c94, FUTEX_WAIT, 12753, {0, 4866243}) = -1 ETIMEDOUT (Connection timed out)
    19:33:50.020022 futex(0x8100528, FUTEX_WAKE, 1) = 0
    19:33:50.020244 gettimeofday({1180892030, 20329}, NULL) = 0
    19:33:50.020426 clock_gettime(CLOCK_REALTIME, {1180892030, 20467348}) = 0
    19:33:50.020500 futex(0x8103c94, FUTEX_WAIT, 12755, {0, 4861652}) = -1 ETIMEDOUT (Connection timed out)

    This sequence is repeated over and over.

     
  • Lars Windolf
    Lars Windolf
    2007-06-04

    Logged In: YES
    user_id=834800
    Originator: NO

    jtjt: Please retest with 1.2.16 and if it works please explain to me why the gettimeofday() function is so expensive :-)

     
  • Lars Windolf
    Lars Windolf
    2007-06-04

    • status: open-fixed --> pending-fixed
     
  • jtjt
    jtjt
    2007-06-05

    Logged In: YES
    user_id=1622838
    Originator: NO

    It's the same in 1.2.16.

    I've checked all places where you call gettimeofday and I guess I found whats wrong. In update_dequeue_requests(update.c) you have this cycle:

            do \{
                request = g\_async\_queue\_try\_pop\(requests\_high\_prio\);
                if\(\!request\) \{
                    GTimeVal wait;
                    g\_get\_current\_time\(&wait\);
                    g\_time\_val\_add\(&wait, 5000\);
                    request = g\_async\_queue\_timed\_pop\(requests\_normal\_prio, &wait\);
                \}
            \} while\(\!request\);
    

    Time in g_time_val_add is in microseconds, so it should wake up every 5 miliseconds. If I change it to 500000, liferea wakes up only 3 times per second compared to 50 times before I changed it.

     
  • jtjt
    jtjt
    2007-06-05

    Logged In: YES
    user_id=1622838
    Originator: NO

    It's the same in 1.2.16.

    I've checked all places where you call gettimeofday and I guess I found whats wrong. In update_dequeue_requests(update.c) you have this cycle:

            do \{
                request = g\_async\_queue\_try\_pop\(requests\_high\_prio\);
                if\(\!request\) \{
                    GTimeVal wait;
                    g\_get\_current\_time\(&wait\);
                    g\_time\_val\_add\(&wait, 5000\);
                    request = g\_async\_queue\_timed\_pop\(requests\_normal\_prio, &wait\);
                \}
            \} while\(\!request\);
    

    Time in g_time_val_add is in microseconds, so it should wake up every 5 miliseconds. If I change it to 500000, liferea wakes up only 3 times per second compared to 50 times before I changed it.

     
  • Lars Windolf
    Lars Windolf
    2007-06-05

    Logged In: YES
    user_id=834800
    Originator: NO

    jtjt: Hereby I declare you the one and only official code reviewer for Liferea!!!

    In some minutes there will be an update release 1.2.16b to includes the fix.

     
    • status: pending-fixed --> closed-fixed
     
  • Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).