[GH-ISSUE #3206] [macOS 27.2 Beta 2] One AmneziaVPN launch creates three duplicate Dock Recent Apps entries #1487

Open
opened 2026-10-13 20:43:42 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @Prikol95 on GitHub (Sep 23, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3206

amnezia-launch.log

Image

Describe the bug

On macOS 27.2 Beta 2, launching AmneziaVPN once creates three identical AmneziaVPN icons in the "Recent Applications" section of the Dock.

Only one AmneziaVPN GUI process is actually running.

The two additional Dock entries appear to be caused by two short-lived /usr/bin/osascript child processes started by AmneziaVPN during application startup.

The issue is reproducible after completely clearing the Dock recent-apps list.

AmneziaVPN version: 5.0.3.0


To reproduce

  1. Quit AmneziaVPN.

  2. Clear the Dock recent-apps list:

defaults delete com.apple.dock recent-apps 2>/dev/null
killall Dock
  1. Verify that the list is empty:
defaults read com.apple.dock recent-apps

Result:

Error: Could not find key 'recent-apps' in domain 'com.apple.dock'.
  1. Launch AmneziaVPN once.

  2. Run:

defaults read com.apple.dock recent-apps

Three AmneziaVPN entries are created immediately.

All three point to exactly the same application:

bundle-identifier = "com.yourcompany.AmneziaVPN"
file:///Applications/AmneziaVPN.app/
file-label = AmneziaVPN

They only have different GUID values.

Example:

GUID = 3735638121
GUID = 3735638122
GUID = 3735638123
  1. Check the actual running AmneziaVPN processes:
pgrep -alf 'Amnezia|amnezia'

Result:

/Applications/AmneziaVPN.app/Contents/MacOS/AmneziaVPN-service
/Applications/AmneziaVPN.app/Contents/MacOS/AmneziaVPN

So only one GUI instance of AmneziaVPN is running.

The second process is the normal privileged AmneziaVPN service.


Expected behavior

Launching AmneziaVPN once should create only one AmneziaVPN entry in the Dock's Recent Applications section.


Actual behavior

One AmneziaVPN launch creates three identical entries in the Dock.

No three AmneziaVPN GUI processes are actually running.


Investigation

I captured the macOS unified log during one AmneziaVPN launch.

During startup, AmneziaVPN starts two /usr/bin/osascript child processes.

For these child processes, LaunchServices performs LSApplicationCheckIn() for /usr/bin/osascript, but the application metadata is associated with AmneziaVPN.

The log contains entries equivalent to:

LSApplicationCheckIn(), app being registered is:"/usr/bin/osascript"

while the generated application record contains:

CFBundleExecutablePath="/usr/bin/osascript"
CFBundleIdentifier="com.yourcompany.AmneziaVPN"
CFBundleName="AmneziaVPN"
CFBundleOriginalExecutablePath="/Applications/AmneziaVPN.app/Contents/MacOS/AmneziaVPN"

LaunchServices then reports:

Application ... has already checked in and an child pid 2928 is checking in,
so forcing a new application record to be created.

The same behavior occurs for another child osascript process.

This matches the three Dock entries:

1 x main AmneziaVPN process
1 x osascript child registered as AmneziaVPN
1 x osascript child registered as AmneziaVPN

= 3 Dock Recent Applications entries

The two osascript processes terminate almost immediately, which is why they are not visible later in pgrep, while the duplicate Dock entries remain.


Suspected source in AmneziaVPN

The macOS autostart implementation uses osascript.

In:

client/ui/utils/qAutoStart.cpp

Autostart::isAutostart() contains:

bool Autostart::isAutostart() {
    QProcess process;
    process.start("osascript", {
        "-e tell application \"System Events\" to get the path of every login item"
    });
    process.waitForFinished(3000);
    const auto output = QString::fromLocal8Bit(process.readAllStandardOutput());
    return output.contains(appPath());
}

SettingsController::isStartMinimizedEnabled() calls isAutoStartEnabled():

bool SettingsController::isStartMinimizedEnabled() const
{
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
    if (!isAutoStartEnabled()) {
        return false;
    }
#endif
    return m_appSettingsRepository->isStartMinimized();
}

During application startup, the start-minimized state appears to be queried twice.

First in:

client/amneziaApplication.cpp

when deciding whether the main window should be shown:

if (!m_coreController || !m_coreController->pageController()->shouldStartMinimized()) {
    win->show();
}

shouldStartMinimized() calls:

return m_settingsController->isStartMinimizedEnabled();

Later in AmneziaApplication::init():

m_coreController->pageController()->showOnStartup();

and showOnStartup() checks the same state again:

void PageController::showOnStartup()
{
    if (!m_settingsController->isStartMinimizedEnabled()) {
        emit raiseMainWindow();
    } else {
        ...
    }
}

This appears to produce two separate calls to Autostart::isAutostart(), and therefore two separate osascript processes during a single application startup.

This matches exactly what is visible in the unified log.


Relevant source files

client/ui/utils/qAutoStart.cpp
client/core/controllers/settingsController.cpp
client/ui/controllers/qml/pageController.cpp
client/amneziaApplication.cpp

The behavior is present in the 5.0.3.0 source tag.

A related change was introduced in commit:

6f119cd08392f5b70382b143311c0f1495592a4f

Commit message includes:

fix: fixed autostart and start minimized

That change added the dependency of isStartMinimizedEnabled() on isAutoStartEnabled().


Possible fixes

Possible approaches:

  1. Do not execute osascript every time isAutoStartEnabled() is read.

  2. Cache the autostart state instead of spawning a new process for every property check.

  3. Avoid checking isStartMinimizedEnabled() twice during application startup.

  4. On modern macOS, consider using the native ServiceManagement / SMAppService API instead of AppleScript/System Events for login item management.

This may also be a LaunchServices behavior/regression in macOS 27.2 Beta 2, but avoiding repeated osascript launches during application state reads would prevent the duplicate application registrations.


Bundle information

The installed application reports:

Identifier=com.yourcompany.AmneziaVPN
Authority=Developer ID Application: Privacy Technologies OU (X7UJ388FXK)
TeamIdentifier=X7UJ388FXK

LaunchServices also reports:

CFBundleShortVersionString = "5.0.3"
CFBundleVersion = 0
CFBundleIdentifier = "com.yourcompany.AmneziaVPN"

The com.yourcompany.AmneziaVPN bundle identifier may also be worth reviewing, although I am not assuming that it is the direct cause of the duplicate Dock entries.


Desktop

  • OS: macOS 27.2 Beta 2
  • Architecture: Apple Silicon / arm64
  • AmneziaVPN: 5.0.3.0
  • Application path:
/Applications/AmneziaVPN.app

Log files

Attached:

amnezia-launch.log

The log was captured during a single clean application launch after clearing the Dock recent-apps list.


Screenshots

Attached screenshot shows three identical AmneziaVPN entries in the Dock after launching the application only once.

Originally created by @Prikol95 on GitHub (Sep 23, 2026). Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/3206 [amnezia-launch.log](https://github.com/user-attachments/files/32586188/amnezia-launch.log) <img width="363" height="164" alt="Image" src="https://github.com/user-attachments/assets/3476dcd2-c72f-4b20-beb4-4553a0a912e4" /> ## Describe the bug On macOS 27.2 Beta 2, launching AmneziaVPN once creates three identical AmneziaVPN icons in the "Recent Applications" section of the Dock. Only one AmneziaVPN GUI process is actually running. The two additional Dock entries appear to be caused by two short-lived `/usr/bin/osascript` child processes started by AmneziaVPN during application startup. The issue is reproducible after completely clearing the Dock recent-apps list. AmneziaVPN version: **5.0.3.0** --- ## To reproduce 1. Quit AmneziaVPN. 2. Clear the Dock recent-apps list: ```bash defaults delete com.apple.dock recent-apps 2>/dev/null killall Dock ```` 3. Verify that the list is empty: ```bash defaults read com.apple.dock recent-apps ``` Result: ```text Error: Could not find key 'recent-apps' in domain 'com.apple.dock'. ``` 4. Launch AmneziaVPN once. 5. Run: ```bash defaults read com.apple.dock recent-apps ``` Three AmneziaVPN entries are created immediately. All three point to exactly the same application: ```text bundle-identifier = "com.yourcompany.AmneziaVPN" file:///Applications/AmneziaVPN.app/ file-label = AmneziaVPN ``` They only have different GUID values. Example: ```text GUID = 3735638121 GUID = 3735638122 GUID = 3735638123 ``` 6. Check the actual running AmneziaVPN processes: ```bash pgrep -alf 'Amnezia|amnezia' ``` Result: ```text /Applications/AmneziaVPN.app/Contents/MacOS/AmneziaVPN-service /Applications/AmneziaVPN.app/Contents/MacOS/AmneziaVPN ``` So only one GUI instance of AmneziaVPN is running. The second process is the normal privileged AmneziaVPN service. --- ## Expected behavior Launching AmneziaVPN once should create only one AmneziaVPN entry in the Dock's Recent Applications section. --- ## Actual behavior One AmneziaVPN launch creates three identical entries in the Dock. No three AmneziaVPN GUI processes are actually running. --- ## Investigation I captured the macOS unified log during one AmneziaVPN launch. During startup, AmneziaVPN starts two `/usr/bin/osascript` child processes. For these child processes, LaunchServices performs `LSApplicationCheckIn()` for `/usr/bin/osascript`, but the application metadata is associated with AmneziaVPN. The log contains entries equivalent to: ```text LSApplicationCheckIn(), app being registered is:"/usr/bin/osascript" ``` while the generated application record contains: ```text CFBundleExecutablePath="/usr/bin/osascript" CFBundleIdentifier="com.yourcompany.AmneziaVPN" CFBundleName="AmneziaVPN" CFBundleOriginalExecutablePath="/Applications/AmneziaVPN.app/Contents/MacOS/AmneziaVPN" ``` LaunchServices then reports: ```text Application ... has already checked in and an child pid 2928 is checking in, so forcing a new application record to be created. ``` The same behavior occurs for another child `osascript` process. This matches the three Dock entries: ```text 1 x main AmneziaVPN process 1 x osascript child registered as AmneziaVPN 1 x osascript child registered as AmneziaVPN = 3 Dock Recent Applications entries ``` The two `osascript` processes terminate almost immediately, which is why they are not visible later in `pgrep`, while the duplicate Dock entries remain. --- ## Suspected source in AmneziaVPN The macOS autostart implementation uses `osascript`. In: ```text client/ui/utils/qAutoStart.cpp ``` `Autostart::isAutostart()` contains: ```cpp bool Autostart::isAutostart() { QProcess process; process.start("osascript", { "-e tell application \"System Events\" to get the path of every login item" }); process.waitForFinished(3000); const auto output = QString::fromLocal8Bit(process.readAllStandardOutput()); return output.contains(appPath()); } ``` `SettingsController::isStartMinimizedEnabled()` calls `isAutoStartEnabled()`: ```cpp bool SettingsController::isStartMinimizedEnabled() const { #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) if (!isAutoStartEnabled()) { return false; } #endif return m_appSettingsRepository->isStartMinimized(); } ``` During application startup, the start-minimized state appears to be queried twice. First in: ```text client/amneziaApplication.cpp ``` when deciding whether the main window should be shown: ```cpp if (!m_coreController || !m_coreController->pageController()->shouldStartMinimized()) { win->show(); } ``` `shouldStartMinimized()` calls: ```cpp return m_settingsController->isStartMinimizedEnabled(); ``` Later in `AmneziaApplication::init()`: ```cpp m_coreController->pageController()->showOnStartup(); ``` and `showOnStartup()` checks the same state again: ```cpp void PageController::showOnStartup() { if (!m_settingsController->isStartMinimizedEnabled()) { emit raiseMainWindow(); } else { ... } } ``` This appears to produce two separate calls to `Autostart::isAutostart()`, and therefore two separate `osascript` processes during a single application startup. This matches exactly what is visible in the unified log. --- ## Relevant source files ```text client/ui/utils/qAutoStart.cpp client/core/controllers/settingsController.cpp client/ui/controllers/qml/pageController.cpp client/amneziaApplication.cpp ``` The behavior is present in the **5.0.3.0** source tag. A related change was introduced in commit: ```text 6f119cd08392f5b70382b143311c0f1495592a4f ``` Commit message includes: ```text fix: fixed autostart and start minimized ``` That change added the dependency of `isStartMinimizedEnabled()` on `isAutoStartEnabled()`. --- ## Possible fixes Possible approaches: 1. Do not execute `osascript` every time `isAutoStartEnabled()` is read. 2. Cache the autostart state instead of spawning a new process for every property check. 3. Avoid checking `isStartMinimizedEnabled()` twice during application startup. 4. On modern macOS, consider using the native ServiceManagement / `SMAppService` API instead of AppleScript/System Events for login item management. This may also be a LaunchServices behavior/regression in macOS 27.2 Beta 2, but avoiding repeated `osascript` launches during application state reads would prevent the duplicate application registrations. --- ## Bundle information The installed application reports: ```text Identifier=com.yourcompany.AmneziaVPN Authority=Developer ID Application: Privacy Technologies OU (X7UJ388FXK) TeamIdentifier=X7UJ388FXK ``` LaunchServices also reports: ```text CFBundleShortVersionString = "5.0.3" CFBundleVersion = 0 CFBundleIdentifier = "com.yourcompany.AmneziaVPN" ``` The `com.yourcompany.AmneziaVPN` bundle identifier may also be worth reviewing, although I am not assuming that it is the direct cause of the duplicate Dock entries. --- ## Desktop * OS: **macOS 27.2 Beta 2** * Architecture: Apple Silicon / arm64 * AmneziaVPN: **5.0.3.0** * Application path: ```text /Applications/AmneziaVPN.app ``` --- ## Log files Attached: ```text amnezia-launch.log ``` The log was captured during a single clean application launch after clearing the Dock recent-apps list. --- ## Screenshots Attached screenshot shows three identical AmneziaVPN entries in the Dock after launching the application only once.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#1487
No description provided.