svdrpsend CLRE doesn't clear EPG completely if there's active timers

  • While I was making xmltv2vdr.pl working I came across possible bug with command svdrpsend CLRE. It doesn't clear EPG completely from channels which has active timers. Is this bug or intended behavior?

    This is problematic while using xmltv because if program's start and end time changes program with wrong start and end time is also displayed in EPG.


    EPG before CLRE: before.txt

    After CLRE: after.txt


    Without active timer output is:


    VDR version

  • The code in cSVDRPServer::CmdCLRE() is supposed to set the events of all timers to NULL, so the intended behavior is that ALL events are cleared by CLRE.


    You might want to check cSchedule::Cleanup(time_t Time) to see if it really deletes all events, and if not, why that happens.

  • The code in cSVDRPServer::CmdCLRE() is supposed to set the events of all timers to NULL, so the intended behavior is that ALL events are cleared by CLRE.


    You might want to check cSchedule::Cleanup(time_t Time) to see if it really deletes all events, and if not, why that happens.


    I'm sorry but how I can check that?


    I set timer to TLC HD. There's also timers to other channels and after clearing EPG all timers are still in timers.conf. Same result when running svdrpsend CLRE without channel number.

  • I think I misunderstood you earlier. So SVDRPServer::CmdCLRE() should set all events to NULL on cSchedule::Cleanup(time_t Time) should clean them? How I can debug it? It looks like CLRE deletes EPG events to the moment when first recording timer is set.

  • Let's assume you're using CLRE w/o any additional parameters, which executes this code in cSVDRPServer::CmdCLRE():

    Code
    1. LOCK_TIMERS_WRITE;
    2. LOCK_SCHEDULES_WRITE;
    3. for (cTimer *Timer = Timers->First(); Timer; Timer = Timers->Next(Timer))
    4. Timer->SetEvent(NULL); // processing all timers here (local *and* remote)
    5. for (cSchedule *Schedule = Schedules->First(); Schedule; Schedule = Schedules->Next
    6. Schedule->Cleanup(INT_MAX);
    7. cEitFilter::SetDisableUntil(time(NULL) + EITDISABLETIME);
    8. Reply(250, "EPG data cleared");

    Here it sets the event of all timers to NULL and calls Cleanup() for all schedules with a time (INT_MAX) that is way in the future.

    So now all schedules should be empty.

    In cSchedule::Cleanup(time_t Time) we have

    Code
    1. cEvent *Event;
    2. while ((Event = events.First()) != NULL) {
    3. if (Event->HasTimer()) dsyslog("event has timer");//XXX
    4. if (!Event->HasTimer() && Event->EndTime() + EPG_LINGER_TIME < Time)
    5. DelEvent(Event);
    6. else
    7. break;
    8. }

    See the line marked with XXX. Add that line to your file and recompile.

    If you issue the CLRE command and get that log message, the event's 'numTimers' member apparently got out of sync and we'll need to further investigate there.

  • kls

    I can easy reproduce the problem of -Dis :


    1. take an unsed channel x

    svdpsend clre x

    all events of this channels are deleted


    2. take an unused channel y

    add a timer (e.g. at the end of the current day)

    svdrpsend clre y

    only events earlier like the timer of this channel are deleted


    Maybe this can help.

    VDR
  • kfb77 I tried that and all events were cleared just as expected.

    Are you using plain vanilla VDR 2.5.6 without any patches and with only the minimum number of plugins necessary?


    What I did see while testing this is that if "CLRE <number>" is issued while the Schedule menu of that channel is open, the list isn't immediately cleared. Closing and reopening it shows that all events are gone (including those at and after the timer). I'll fix this.

  • Are you using plain vanilla VDR 2.5.6

    No, its 2.4.7 from yavdr repository with satip, epg2vdr, epgsearch, live and markad plugin. But I can test it later with 2.5.6 plain vanilla.



    What I did see while testing this is that if "CLRE <number>" is issued while the Schedule menu of that channel is open, the list isn't immediately cleared. Closing and reopening it shows that all events are gone (including those at and after the timer). I'll fix this.

    I use live and "svdrpsend lste" as test frontend, this is a headless vdr server.

    VDR
  • Same result with current plain vanilla vdr version.

    epg2vdr is the only plugin who can have an impact to events, but test channels are not in epg2vdr channel map, so they will be untouched.

    Code
    1. root@VDR-2004-Dev:/usr/src/git# vdr --version
    2. vdr (2.5.6/2.5.6) - The Video Disk Recorder
    3. conflictcheckonly (0.0.1) - Direct access to epgsearch's conflict check menu
    4. epg2vdr (1.1.118-GIT) - epg2vdr plugin
    5. epgsearch (2.4.1) - search the EPG for repeats and more
    6. epgsearchonly (0.0.1) - Direct access to epgsearch's search menu
    7. live (3.0.10) - Live Interactive VDR Environment
    8. markad (3.0.9) - Mark advertisements
    9. quickepgsearch (0.0.1) - Quick search for broadcasts
    10. satip (2.4.1) - SAT>IP Devices

    channel without timer: svdrpsend clre 54 && svdrpsend lste 54

    Code
    1. 220 VDR-2004-Dev SVDRP VideoDiskRecorder 2.5.6; Wed Aug 4 12:12:08 2021; UTF-8^M
    2. 215-C S19.2E-133-5-662 1-2-3.tv
    3. 215-c
    4. 215 End of EPG data^M
    5. 221 VDR-2004-Dev closing connection^M


    channel with timer at the end of today (UHREN SALE, 23:00 - 00:00 Uhr): svdrpsend clre 55 && svdrpsend lste 55


    Both channel had the same events before (1-2-3.tv HD and non HD) and only the 2 events (Night Deals and Morning Deals) after today. A good channel for this tests.

    VDR
  • I tried to reproduce this, but everything worked as expected:

  • -Dis sorry for hijacking your thread.

    kls

    I have done some debugging with this changes in your code:

    After second clre 107 (at this time we have only events after the timer) I got:

    Code
    1. Aug 5 10:37:44 VDR-2004-Dev vdr: [89289] CLRE: ChannelID: S19.2E-1-1051-28724
    2. Aug 5 10:37:44 VDR-2004-Dev vdr: [89289] CLRE: timer file name: The Beatles: Eight Days a Week
    3. Aug 5 10:37:44 VDR-2004-Dev vdr: [89289] CLRE SetEvent called
    4. Aug 5 10:37:44 VDR-2004-Dev vdr: [89289] timer 8 (107 2153-2355 'The Beatles: Eight Days a Week') set to no event
    5. Aug 5 10:37:44 VDR-2004-Dev vdr: [89289] CLRE event has timer: The Beatles: Eight Days a Week
    6. Aug 5 10:37:44 VDR-2004-Dev vdr: [89289] SVDRP VDR-2004-Dev < 127.0.0.1:36460 connection closed
    7. Aug 5 10:37:44 VDR-2004-Dev vdr: [89289] SVDRP VDR-2004-Dev < 127.0.0.1:36460 server destroyed
    8. Aug 5 10:37:45 VDR-2004-Dev vdr: [89267] CLRE SetEvent called
    9. Aug 5 10:37:45 VDR-2004-Dev vdr: [89267] timer 8 (107 2153-2355 'The Beatles: Eight Days a Week') set to event Fr. 06.08.2021 21:55-23:45 (VPS: 06.08. 21:55) 'The Beatles: Eight Days a Week'


    There is something not working on our systems, but on yours it works. As you see, after calling SetEvent(NULL) this events still reports a timer, it can not be deleted and exits the loop with break. If I quick and dirty remove the check "!Event->HasTimer()" in epg.c all events of this channel are deleted.


    I assume the problem in "bool cTimer::SetEvent(const cEvent *Event)" but I do not understand, what you are doing here in case of called with NULL.

    VDR
  • I have also check our common plugins and tested without markad, no changes too.

    Can you test without live, this is the last common plugin. I will have no frontend if I remove live because it is a headless server.

    VDR
  • Can you please add these lines and post the results?

  • I have also check our common plugins and tested without markad, no changes too.

    Can you test without live, this is the last common plugin. I will have no frontend if I remove live because it is a headless server.

    Tried without live plugin with previously set timers and after uninstalling live CLRE command did clear all epg events.

  • Can you please add these lines and post the results?

    with live plugin:

    without live (now I am without frontend ;-)

    Code
    1. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] SVDRP VDR-2004-Dev < 127.0.0.1:51824 client connection accepted
    2. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] SVDRP VDR-2004-Dev > 127.0.0.1:51824 server created
    3. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] CLRE: ChannelID: S19.2E-1-1051-28724
    4. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] CLRE: timer file name: The Beatles: Eight Days a Week
    5. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] CLRE SetEvent called
    6. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] CLRE DecNumTimers 0 The Beatles: Eight Days a Week
    7. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] timer 8 (107 2153-2355 'The Beatles: Eight Days a Week') set to no event
    8. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] SVDRP VDR-2004-Dev < 127.0.0.1:51824 connection closed
    9. Aug 5 13:17:29 VDR-2004-Dev vdr: [109939] SVDRP VDR-2004-Dev < 127.0.0.1:51824 server destroyed

    numTimers values of all timers are 1 bigger with live than without ???

    VDR