• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: FSEvents API not working after restarting fseventsd daemon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FSEvents API not working after restarting fseventsd daemon


  • Subject: Re: FSEvents API not working after restarting fseventsd daemon
  • From: Ashish Saxena <email@hidden>
  • Date: Sat, 14 Jun 2014 02:41:32 +0530

>
> I have a long running process that periodically (once every half hour) uses
> FSEvents API to find list of modified files in a particular folder. I am
> seeing following problem with the APIs:

Any particular reason you're not just leaving an FSEventStream open while
your long-running process runs?  It takes more work to dig through historical
events because they need to be read out of on-disk logs.

I use the set of changes in one go every half hour (or more - the duration is configurable and could be very long). If I keep the stream open, then I will have to persist the events till I use them (to avoid losing them on app crash or reboot). Since FSEvents already persists the events, it makes sense to not duplicate the effort and read them when needed.   
 
> If fseventsd daemon is stopped and started (using launchctl or killing the
> process), then further calls to FSEvents API fails. FSEventsStreamStart()
> always fails after fseventsd is restarted. APIs like
> FSEventsGetCurrentEventId() starts returning 0 and
>  FSEventsCopyUUIDForDevice() returns NULL UUID, both of which are wrong.
>
> Please let me know what is required to successfully call FSEvents API after
> restart of fseventd daemon. I want to take care of this issue so that my
> application starts using FSEvents even when fseventsd is restarted.

You should never need or want to stop/restart fseventsd.
fseventsd should always be running... otherwise events will be dropped.

My app never stops/starts fseventsd. However, I want to make sure that the app does not miss any file change in any scenario - be it someone killing fseventsd or restarting it using the supported launchctl command. If the daemon is restarted, I detect that using changed UUID (and use alternative methods to detect changes).

However, I expect that in the next cycle (second after the restart) I should be able to use FSEvents again - but this is the case where the API is not working.
 
 
If fseventsd isn't working properly, please file a bug with Apple.
If the FSEvents API isn't working properly, please file a bug with Apple.

If the FSEvents API isn't working properly BECAUSE fseventsd is being
manipulated in unusual/unsupported ways, you can file a bug with Apple
but it probably won't be assigned a very high priority.

Thanks for the inputs. But being new to Mac development, I want to know if my understanding about the API and Carbon framework is correct and I am not missing something which can fix the problem. To explain the case, consider a small C code:

#import <CoreServices/CoreServices.h>
int main()
{
    while (1)
    {
        printf("Current Event ID = %d\n", FSEventsGetCurrentEventId());
        // any initialization/cleanup needed here to handle restart case ??
        sleep(5);
    }
}

Until fseventsd is stopped, everything works fine and the program print correct event ID values. However, when stopped, the program starts printing 0, and it keeps printing 0 forever - even long after the daemon comes up. My query is - is there some initialization/cleanup API that can be called to make the next call work correctly. If not, then I will open a bug with Apple.

Thanks,
Ashish 

THanks
--macko

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: FSEvents API not working after restarting fseventsd daemon
      • From: Mike Mackovitch <email@hidden>
References: 
 >FSEvents API not working after restarting fseventsd daemon (From: Ashish Saxena <email@hidden>)
 >Re: FSEvents API not working after restarting fseventsd daemon (From: Mike Mackovitch <email@hidden>)

  • Prev by Date: Re: FSEvents API not working after restarting fseventsd daemon
  • Next by Date: Re: FSEvents API not working after restarting fseventsd daemon
  • Previous by thread: Re: FSEvents API not working after restarting fseventsd daemon
  • Next by thread: Re: FSEvents API not working after restarting fseventsd daemon
  • Index(es):
    • Date
    • Thread