[PR #500] [MERGED] Fix startup failure from fd exhaustion when launched via Finder #3349

Closed
opened 2026-07-15 02:02:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/500
Author: @gschier
Created: 7/5/2026
Status: Merged
Merged: 7/5/2026
Merged by: @gschier

Base: mainHead: fix-fd-exhaustion-launch


📝 Commits (3)

  • 8365194 Fix startup failure from fd exhaustion when launched via Finder
  • a99bcaa Merge branch 'main' into fix-fd-exhaustion-launch
  • 8e4dbca Remove Mutex around blob pool as well

📊 Changes

6 files changed (+46 additions, -35 deletions)

View changed files

📝 Cargo.lock (+12 -2)
📝 crates-tauri/yaak-app-client/Cargo.toml (+3 -0)
📝 crates-tauri/yaak-app-client/src/lib.rs (+8 -0)
📝 crates/yaak-models/src/blob_manager.rs (+6 -9)
📝 crates/yaak-models/src/lib.rs (+8 -3)
📝 crates/yaak-models/src/query_manager.rs (+9 -21)

📄 Description

Summary

Since #496 enabled WAL, each pooled SQLite connection holds ~3 file descriptors, and the pools eagerly opened all 150 connections at startup — blowing past the 256 open-file soft limit launchd gives GUI apps. The blobs DB then failed to open ("timed out waiting for connection: unable to open database file") unless the app was launched from a shell with a higher ulimit.

Fixes:

  • Size pools for concurrent in-flight queries (20 main / 10 blobs) with small min_idle so startup opens 3 connections instead of 150
  • Remove the Mutex around the pool — r2d2 is internally synchronized, and blocking inside get() while holding the lock froze all DB access whenever the pool was exhausted
  • Raise the open-file soft limit to 10240 at startup on macOS/Linux via the rlimit crate

Submission

  • This PR is a bug fix.
  • If this PR is not a bug fix, I linked the feedback item where @gschier explicitly gave me permission to work on it.
  • I have read and followed CONTRIBUTING.md.
  • I tested this change locally.
  • I added or updated tests, or tests are not reasonable for this change.
  • I added screenshots or recordings, or this change does not affect the UI.

Related


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mountain-loop/yaak/pull/500 **Author:** [@gschier](https://github.com/gschier) **Created:** 7/5/2026 **Status:** ✅ Merged **Merged:** 7/5/2026 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `fix-fd-exhaustion-launch` --- ### 📝 Commits (3) - [`8365194`](https://github.com/mountain-loop/yaak/commit/8365194780948e7d3a914f0e0ad44a5f2a9f8e56) Fix startup failure from fd exhaustion when launched via Finder - [`a99bcaa`](https://github.com/mountain-loop/yaak/commit/a99bcaa4811504d42700aa42a6a8aaae241d5605) Merge branch 'main' into fix-fd-exhaustion-launch - [`8e4dbca`](https://github.com/mountain-loop/yaak/commit/8e4dbca927559dcf4c4199b443ea6d27d1766a8d) Remove Mutex around blob pool as well ### 📊 Changes **6 files changed** (+46 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+12 -2) 📝 `crates-tauri/yaak-app-client/Cargo.toml` (+3 -0) 📝 `crates-tauri/yaak-app-client/src/lib.rs` (+8 -0) 📝 `crates/yaak-models/src/blob_manager.rs` (+6 -9) 📝 `crates/yaak-models/src/lib.rs` (+8 -3) 📝 `crates/yaak-models/src/query_manager.rs` (+9 -21) </details> ### 📄 Description ## Summary Since #496 enabled WAL, each pooled SQLite connection holds ~3 file descriptors, and the pools eagerly opened all 150 connections at startup — blowing past the 256 open-file soft limit launchd gives GUI apps. The blobs DB then failed to open ("timed out waiting for connection: unable to open database file") unless the app was launched from a shell with a higher ulimit. Fixes: - Size pools for concurrent in-flight queries (20 main / 10 blobs) with small `min_idle` so startup opens 3 connections instead of 150 - Remove the `Mutex` around the pool — r2d2 is internally synchronized, and blocking inside `get()` while holding the lock froze all DB access whenever the pool was exhausted - Raise the open-file soft limit to 10240 at startup on macOS/Linux via the `rlimit` crate ## Submission - [x] This PR is a bug fix. - [ ] If this PR is not a bug fix, I linked the feedback item where @gschier explicitly gave me permission to work on it. - [x] I have read and followed [`CONTRIBUTING.md`](CONTRIBUTING.md). - [x] I tested this change locally. - [x] I added or updated tests, or tests are not reasonable for this change. - [x] I added screenshots or recordings, or this change does not affect the UI. ## Related - #496 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-07-15 02:02:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/yaak#3349