SpartanJ / efsw

efsw is a C++ cross-platform file system watcher and notifier.
Other
662 stars 101 forks source link

Occasional crash on MacOS #127

Closed vyunikov closed 2 years ago

vyunikov commented 3 years ago

Our app uses efsw library to monitor FS for changes. Based on crash reports from out users, app is occasionally crashing when efsw is being initialized. Stack trace looks like this: libefsw.dylib efsw::WatcherFSEvents::initAsync() WatcherFSEvents.cpp:78 libefsw.dylib efsw::FileWatcherFSEvents::run() FileWatcherFSEvents.cpp:223 libefsw.dylib efsw::Platform::ThreadImpl::entryPoint(void*) ThreadImpl.cpp:61 libsystem_pthread.dylib _pthread_start libsystem_pthread.dylib thread_start

The following line is causing a crash:

FSEventStreamScheduleWithRunLoop( FSStream, FWatcher->mRunLoopRef, kCFRunLoopDefaultMode );

Do you have an idea, why it might be crashing?

SpartanJ commented 3 years ago

I have no idea. Do you have any hints on how and when is initialized? Can I test your application on me macOS setup? The source is available? Thanks

vyunikov commented 3 years ago

I am not doing any specific initialization. What I do is I just create watcher when needed, and that's when I guess initialization happens. Unfortunately I cannot reproduce the crash myself, it just happens rarely for some users (I see the crash reports). Unfortunately I cannot provide you with the code, as our code is not publicly available.

SpartanJ commented 3 years ago

Are you experiencing the same issue? Can you provide some information?

SineStriker commented 3 years ago

Not yet. I just worry about it.

SpartanJ commented 3 years ago

@vyunikov is there any relevant information that you can add to the current information? Maybe how many watches were created, if they were recursive, or if you add and remove watches intensively? Thanks

vyunikov commented 3 years ago

@SpartanJ Sorry for the late response.

All watchers are created with the following API call:

FileWatcher::addWatch

All watches are non-recursive. Based on the logging I see, it looks like every time the app crashed, there were a lot of watches created one by one (up to several hundreds in some cases). And none of them have been removed before the crash.

Hope it helps. Please let me know if you need anything else.

SineStriker commented 3 years ago

Also find occasional crash under windows and linux, every crash occurs when removeWatch is called.

SpartanJ commented 3 years ago

Open a new issue ticket for each platform describing it. If you're finding any occasional crashes during the development of your application please try to reproduce the issue in debug mode so you can provide valuable information regarding the issue.