nextcloud / nextcloud/desktop

[Bug]: Syncing a lot of files can lead to (Mach) Port leak and termination by macOS

Open
#8,464 1 comment 1 reaction 0 assignees View on GitHub
0. Needs triage bug feature: :file_folder: file provider os: :apple: macOS
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
1d 17h
Merged PRs (30d)
123

Description

### ⚠️ Before submitting, please verify the following: ⚠️

- [x] This is a **bug**, not a question or a configuration issue.
- [x] This issue is **not** already reported on Github (I've searched it).
- [x] Nextcloud Server and Desktop Client are **up to date**. See [Server Maintenance and Release Schedule](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) and [Desktop Releases](https://nextcloud.com/install/#install-clients) for supported versions.
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/)

### Bug description

I'm currently attempting to sync my photos folder which contains around 180.000 files. I noticed that after some hours of runtime, the nextloud client suddenly stops being run. The console app shows that it was terminated for having too many (Mach) ports open. Do you need the debug archive from the desktop client in this case? I attach the header of the Console output (full file is too long).

### Steps to reproduce

Sync large photos folder with 180.000 files

### Expected behavior

syncing, not crashing

### Which files are affected by this bug

no particular file

### Operating system

macOS

### Which version of the operating system you are running.

macOS Sequoia 15.5

### Package

Official macOS 12+ universal pkg

### Nextcloud Server version

31.0.7

### Nextcloud Desktop Client version

3.16.6 vfs

### Is this bug present after an update or on a fresh install?

Updated from a minor version (ex. 3.4.2 to 3.4.4)

### Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

### Are you using an external user-backend?

- [ ] Default internal user-backend
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other

### Nextcloud Server logs

```shell

```

### Additional info

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process: Nextcloud [85831]
Path: /Applications/Nextcloud.app/Contents/MacOS/Nextcloud
Identifier: com.nextcloud.desktopclient
Version: 3.16.6 (3.16.6.0)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501

Date/Time: 2025-07-15 02:29:11.7026 +0200
OS Version: macOS 15.5 (24F74)
Report Version: 12
Anonymous UUID: 403AAFF1-90BE-5D70-C84C-F7EB6830469C

Sleep/Wake UUID: A42D101C-5AC2-4C7B-8054-575BA26CE163

Time Awake Since Boot: 110000 seconds
Time Since Wake: 39697 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_RESOURCE (SIGKILL)
Exception Codes: 0x0000000000041610, 0x0000000000000000

Termination Reason: Namespace PORT_SPACE, Code 14123288431434143248 (Limit 267792 ports) Exceeded system-wide per-process Port Limit

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x18578cad8 _kernelrpc_mach_port_allocate_trap + 8
1 libsystem_kernel.dylib 0x18578edc8 mach_port_allocate + 36
2 QuartzCore 0x18eabd2a0 CA::Context::synchronize(unsigned int, int, bool) + 136
3 QuartzCore 0x18e94d1a0 CABackingStoreSynchronize(CABackingStore*, CA::GenericContext*, unsigned int, int) + 108
4 QuartzCore 0x18e92c444 CABackingStorePrepareUpdates_(CABackingStore*, unsigned long, unsigned long, unsigned int, unsigned int, unsigned int, unsigned long long, CA::GenericContext*, UpdateState*) + 1432
5 QuartzCore 0x18e92bc20 CABackingStoreUpdate_ + 460
6 QuartzCore 0x18e983a1c invocation function for block in CA::Layer::display_() + 120
7 QuartzCore 0x18e92af18 -[CALayer _display] + 1600
8 AppKit 0x189c98130 0x1897a5000 + 5189936
9 AppKit 0x189c98954 0x1897a5000 + 5192020
10 AppKit 0x189b607ac 0x1897a5000 + 3913644
11 AppKit 0x189c98234 0x1897a5000 + 5190196
12 QuartzCore 0x18e92a0b4 CA::Layer::display_if_needed(CA::Transaction*) + 748
13 QuartzCore 0x18eabe464 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 492
14 QuartzCore 0x18e90b3a8 CA::Transaction::commit() + 644
15 AppKit 0x189902024 __62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 272
16 AppKit 0x18a34b4d4 ___NSRunLoopObserverCreateWithHandler_block_invoke + 64
17 CoreFoundation 0x1858b9098 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
18 CoreFoundation 0x1858b8f80 __CFRunLoopDoObservers + 536
19 CoreFoundation 0x1858b85f0 __CFRunLoopRun + 784
20 CoreFoundation 0x1858b7c58 CFRunLoopRunSpecific + 572
21 HIToolbox 0x19134c27c RunCurrentEventLoopInMode + 324
22 HIToolbox 0x19134f4e8 ReceiveNextEventCommon + 676
23 HIToolbox 0x1914da484 _BlockUntilNextEventMatchingListInModeWithFilter + 76
24 AppKit 0x1897dfab4 _DPSNextEvent + 684
25 AppKit 0x18a17e5b0 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
26 libqcocoa.dylib 0x10b010f40 0x10aff8000 + 102208
27 QtCore 0x104922ce8 QEventLoop::exec(QFlags) + 596
28 QtCore 0x104919460 QCoreApplication::exec() + 216
29 Nextcloud 0x100a05300 main + 2760
30 dyld 0x18542eb98 start + 6076

...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.