Duplicate Finder Sync menu items and process

Hi all,


We have a non sandboxed mac app along with a finder sync app extension. The main goal for this Finder sync app extension is to monitor a folder and display contextual menu items when the user right clicks a file in this location. This works great most of the time however during upgrade/reinstalls we sometimes see duplicate menu items. We have noticed that during these times that there are two Finder sync processes running at the same time and this may be causing the duplicate menu items.


After observing the console logs i can see launchd launching the extension twice. Why is launchd doing this?

I also noticed the most of the time Runningboardd notices that their are duplicated processes running and kills one of them.


Is there anything we can/should do in our app extension that will prevent the launchd from executing the Findersync extension multiple times?


Any help and insight would be greatly apperiated

Replies

This works great most of the time however during upgrade/reinstalls we sometimes see duplicate menu items. We have noticed that during these times that there are two Finder sync processes running at the same time and this may be causing the duplicate menu items.

This sure sounds like a bug to me. Next time you see it happen, please trigger a sysdiagnose log and file a bug describing the observed behaviour and including that log.

Note For more information about sysdiagnose logs, see our Bug Reporting > Profiles and Logs page.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your response Eskimo. I will reproduce the issue and provide the bug number in my next response.

Was able to reproduce the issue and sent the logs to Feedback Assistant.

Bug Number: FB7611511

Multiple process copies of your Finder Sync extension running at once is normal and expected.


When I look at Activity Monitor for my app, there are almost always 2 Finder Sync exensions running. Sometimes 4 or more.


I have never seen multiple extensions "run for the same menu", however. Never seen duplicated menu items due to muliple extension processes running.


I would guess that your problem is rather an issue where a single extension is for some reason duplicating the menu items. Or a problem with multiple apps/bundleIDs, which would be different than multiple processes of the same Extension with the same bundleID.


docs:


> https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/Finder.html


> The system may also launch additional copies of your extension whenever an Open or Save dialog is displayed. This means that the user may have multiple copies of your extension running at once, and some may be very short lived. Therefore, it’s generally best if the extension focuses on handling the badges, contextual menus, and toolbar buttons. Place in a separate service (a Login Item or Launch Agent) any code that performs the sync, updates state, or communicates with remote data sources. This approach ensures that there is only one syncing service running at a time.