Files
proxypin/pubspec.yaml
testercengdong 202050b35f fix(macos): use libproc FFI for process info to eliminate fork leak
Replace Process.run('lsof') and Process.run('ps') in the request hot
path with direct libproc syscalls (proc_listpids, proc_pidinfo,
proc_pidfdinfo, proc_pidpath) via dart:ffi.

Each Process.run on macOS goes through fork()+execvp(). In a
multi-threaded Dart VM the forked child can deadlock before exec on
mutexes that were held by other threads at fork time (POSIX fork()
only clones the calling thread, leaving cloned mutex state with no
owners in the child). Under proxy load (~500 concurrent requests),
roughly 2% of the fork()s deadlock; the orphaned children inherit the
listening proxy fd and pin it for the lifetime of the system, so the
port stays bound even after the parent app exits.

libproc syscalls do not spawn child processes, so they avoid the fork
problem entirely. They are also about an order of magnitude faster
than spawning lsof per request.

Windows and Linux paths are unchanged (independent follow-up).

Verified end-to-end on macOS 26.4 / Darwin 25.4:
- 500 concurrent curl through the proxy: 0 fork leaks (was ~2% before)
- Process icons still resolve correctly for .app bundles (Chrome,
  Safari, Lark, etc.)
- 9099 frees immediately on app exit (no orphan listeners)

Fixes #763
2026-05-11 15:23:59 +08:00

71 lines
1.6 KiB
YAML

name: proxypin
description: ProxyPin
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.2.7+30
environment:
sdk: '>=3.0.2 <4.0.0'
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: any
cupertino_icons: ^1.0.9
pointycastle: ^4.0.0
logger: ^2.7.0
date_format: ^2.0.9
window_manager: ^0.5.1
desktop_multi_window:
git:
url: https://gitee.com/wanghongenpin/flutter-plugins.git
path: packages/desktop_multi_window
path_provider: ^2.1.5
file_picker: ^10.3.10
proxy_manager: ^0.0.3
permission_handler: ^12.0.1
flutter_toastr: ^1.0.3
share_plus: ^12.0.2
flutter_js: ^0.8.7
flutter_code_editor:
git:
url: https://github.com/wanghongenpin/flutter-code-editor.git
ref: secure-keyboard
flutter_highlight: ^0.7.0
flutter_desktop_context_menu: ^0.2.0
device_info_plus: ^12.4.0
shared_preferences: ^2.5.5
url_launcher: ^6.3.2
toastification: ^3.0.2
get: ^4.7.3
zstandard: ^1.5.0
qr_flutter: ^4.1.0
flutter_qr_reader_plus: ^1.0.6
brotli: ^0.6.0
html: ^0.15.6
xml: ^6.6.1
ffi: ^2.1.0
# macos_window_utils: 1.6.1
win32audio: ^1.3.1
vclibs: ^0.1.3
scrollable_positioned_list_nic: ^0.0.2
tray_manager: ^0.5.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^6.0.0
# The following section is specific to Flutter packages.
flutter:
generate: true
uses-material-design: true
assets:
- assets/certs/ca.crt
- assets/certs/ca_key.pem
- assets/icon.png
- assets/icon.ico
- assets/icon_foreground.png
- assets/js/