RFR: 8293067: (fs) Implement WatchService using system library (macOS)
Michael Hall
mik3hall at gmail.com
Tue Nov 29 09:56:36 UTC 2022
> On Nov 29, 2022, at 2:47 AM, Maxim Kartashev <mkartashev at openjdk.org> wrote:
>
> FSEventStreamCreate
This is sounding somewhat similar to the kqueue watcher I attempted. It was suggested this was due to maxing out file descriptors. Which seems plausible. What I would see was that suddenly the kernel would cease sending events at all.
https://developer.apple.com/documentation/coreservices/1443980-fseventstreamcreate <https://developer.apple.com/documentation/coreservices/1443980-fseventstreamcreate>
The number of seconds the service should wait after hearing about an event from the kernel
Note this indicates it is still based on receiving events from the kernel. The following was my code, it shows originally I did no polling at all but changed it to do polling thinking this was a thread deadlock issue. But with polling my thread continued to run, it was the kernel that totally stopped sending events. Again this seems potentially similar to what is being described for errors here. It occurred in trying mine on the LotsOfEvents test. Maybe there would be some way you could check for this situation? The errors all seem to be timeouts when things stop happening, or I suppose happen but are missed?
-(void) watcherThread: (id)sender
{
int n;
int idle_cnt = 0;
struct kevent64_s ev;
struct timespec timeout = { 5, 0 }; // 5 seconds timeout.
int theFD = queueFD; // So we don't have to risk accessing iVars when the thread is terminated.
struct timespec nullts = { 1, 0 };
while( keepThreadRunning )
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NS_DURING
// NSLog(@"going into kevent");
n = kevent64( queueFD, NULL, 0, &ev, 1, 0, &timeout );
// n = kevent64( queueFD, NULL, 0, &ev, 1, 0, &nullts );
// n = kevent64( queueFD, NULL, 0, &ev, 1, 0, NULL);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/nio-dev/attachments/20221129/53d9cca9/attachment.htm>
More information about the nio-dev
mailing list