SpartanJ / efsw

efsw is a C++ cross-platform file system watcher and notifier.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Occasional crash on MacOS

vyunikov opened this issue · comments

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?

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

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.

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

Not yet. I just worry about it.

@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

@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.

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

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.