#128 inotify sometime starts after a full program loop (15 min)


From what I understand of the code, at startup:
- minidlna starts and launches a scanner process
- at the same time, minidlna enters a loop that, when idle, lasts by default around 15 minutes
- during the loop, minidlna checks if the scanning finished. If so, the main thread sets "scanning = 0" and the inotify thread is free to start and directories start to be watched

I experianced an issue related to this behaviour: if at startup scanning lasts for more than a few seconds, then the inotify thread has to wait for a full loop to start watching directories. In practise, this means that for the first 15 minutes directories are not watched and no changes are intercepted.

This may lead to some puzzlement as to why sometimes added media are not displayed, and force users to rebuild their databases.

Maybe there is a way to set "scanning = 0" earlier in the code, e.g. directly in 'scanner.c', so that inotify can start as soon as scanning finishes?


  • Justin Maggard

    Justin Maggard - 2012-05-17

    Usually this isn't an issue, because on most networks using DLNA there will be regular SSDP traffic on the network that will wake up select() in the main loop. But there are certainly some cases where one could run into this.

    This should be addressed in CVS HEAD now. While scanning, we now have a SIGCHLD handler set up, which will interrupt the select() when the scanner child exits. It works for me, but it would be great if you could verify.

  • Justin Maggard

    Justin Maggard - 2012-05-17
    • assigned_to: nobody --> jmaggard
    • status: open --> open-fixed
  • Gregorio Guidi

    Gregorio Guidi - 2012-05-18

    I tested the last version from CVS and I confirm that now it works as you described, directories start to be monitored as soon as the scanner finishes. Thanks a lot for taking the time to look at this, it is really appreciated.

  • Justin Maggard

    Justin Maggard - 2012-05-19

    Great, thanks for verifying!

  • Justin Maggard

    Justin Maggard - 2012-05-19
    • status: open-fixed --> closed-fixed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks