[PR #7812] [MERGED] chore: fix potential open rocksdb for the same user #8131

Closed
opened 2026-03-23 23:22:45 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/7812
Author: @appflowy
Created: 4/23/2025
Status: Merged
Merged: 4/23/2025
Merged by: @appflowy

Base: mainHead: fix_potential_open_rocksdb_error


📝 Commits (5)

📊 Changes

39 files changed (+517 additions, -276 deletions)

View changed files

📝 frontend/appflowy_flutter/macos/Podfile.lock (+1 -1)
📝 frontend/appflowy_flutter/packages/appflowy_backend/lib/log.dart (+1 -1)
📝 frontend/rust-lib/event-integration-test/src/lib.rs (+1 -1)
📝 frontend/rust-lib/event-integration-test/src/user_event.rs (+1 -1)
📝 frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/file_upload_test.rs (+1 -1)
📝 frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/auth_test.rs (+31 -0)
📝 frontend/rust-lib/flowy-ai/src/ai_manager.rs (+5 -0)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/database_deps.rs (+1 -1)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs (+1 -3)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/folder_deps_chat_impl.rs (+12 -6)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/folder_deps_database_impl.rs (+24 -18)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/folder_deps_doc_impl.rs (+24 -10)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/mod.rs (+4 -4)
📝 frontend/rust-lib/flowy-core/src/deps_resolve/user_deps.rs (+17 -9)
📝 frontend/rust-lib/flowy-core/src/lib.rs (+32 -28)
📝 frontend/rust-lib/flowy-core/src/user_state_callback.rs (+91 -39)
📝 frontend/rust-lib/flowy-database2/src/manager.rs (+26 -8)
📝 frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs (+12 -4)
📝 frontend/rust-lib/flowy-document/src/manager.rs (+17 -4)
📝 frontend/rust-lib/flowy-document/tests/document/util.rs (+7 -2)

...and 19 more files

📄 Description

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Refactor dependency management to use weak references, preventing potential memory leaks and improving resource management across various managers in the AppFlowy application.

Enhancements:

  • Replaced strong Arc references with Weak references in multiple managers to prevent circular references
  • Added helper methods to safely upgrade weak references with error handling
  • Implemented Drop trait for managers to log tracing information during object destruction

Chores:

  • Updated multiple manager and service implementations to use weak references
  • Modified dependency resolution methods to work with weak references
  • Added error handling for reference upgrades

🔄 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/AppFlowy-IO/AppFlowy/pull/7812 **Author:** [@appflowy](https://github.com/appflowy) **Created:** 4/23/2025 **Status:** ✅ Merged **Merged:** 4/23/2025 **Merged by:** [@appflowy](https://github.com/appflowy) **Base:** `main` ← **Head:** `fix_potential_open_rocksdb_error` --- ### 📝 Commits (5) - [`7fc2fd5`](https://github.com/AppFlowy-IO/AppFlowy/commit/7fc2fd56f0199dd27852d1e63e06ec0cd55a9f4b) fix: retain cycle - [`914a89b`](https://github.com/AppFlowy-IO/AppFlowy/commit/914a89b66c145b792579439844986cd22440776b) Merge branch 'main' into fix_potential_open_rocksdb_error - [`7d15094`](https://github.com/AppFlowy-IO/AppFlowy/commit/7d15094f9cbceeb43549597a8a00f970929f2d29) fix: test - [`b19b7bb`](https://github.com/AppFlowy-IO/AppFlowy/commit/b19b7bbbf95348c03d681f381706ecf617013981) fix: disable flutter log on test - [`14d51f9`](https://github.com/AppFlowy-IO/AppFlowy/commit/14d51f9123ca2bfc29e835173b1327fca7412a2d) chore: fmt ### 📊 Changes **39 files changed** (+517 additions, -276 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_flutter/macos/Podfile.lock` (+1 -1) 📝 `frontend/appflowy_flutter/packages/appflowy_backend/lib/log.dart` (+1 -1) 📝 `frontend/rust-lib/event-integration-test/src/lib.rs` (+1 -1) 📝 `frontend/rust-lib/event-integration-test/src/user_event.rs` (+1 -1) 📝 `frontend/rust-lib/event-integration-test/tests/document/af_cloud_test/file_upload_test.rs` (+1 -1) 📝 `frontend/rust-lib/event-integration-test/tests/user/af_cloud_test/auth_test.rs` (+31 -0) 📝 `frontend/rust-lib/flowy-ai/src/ai_manager.rs` (+5 -0) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/database_deps.rs` (+1 -1) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs` (+1 -3) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/folder_deps_chat_impl.rs` (+12 -6) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/folder_deps_database_impl.rs` (+24 -18) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/folder_deps_doc_impl.rs` (+24 -10) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/mod.rs` (+4 -4) 📝 `frontend/rust-lib/flowy-core/src/deps_resolve/user_deps.rs` (+17 -9) 📝 `frontend/rust-lib/flowy-core/src/lib.rs` (+32 -28) 📝 `frontend/rust-lib/flowy-core/src/user_state_callback.rs` (+91 -39) 📝 `frontend/rust-lib/flowy-database2/src/manager.rs` (+26 -8) 📝 `frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs` (+12 -4) 📝 `frontend/rust-lib/flowy-document/src/manager.rs` (+17 -4) 📝 `frontend/rust-lib/flowy-document/tests/document/util.rs` (+7 -2) _...and 19 more files_ </details> ### 📄 Description <!--- Thank you for submitting a pull request to AppFlowy. The team will dedicate their best efforts to reviewing and approving your pull request. If you have any questions about the project or feedback for us, please join our [Discord](https://discord.gg/wdjWUXXhtw). --> <!--- If your pull request adds a new feature, please drag and drop a video into this section to showcase what you've done! If not, you may delete this section. --> ### Feature Preview <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [ ] My code adheres to [AppFlowy's Conventions](https://docs.appflowy.io/docs/documentation/software-contributions/conventions) - [ ] I've listed at least one issue that this PR fixes in the description above. - [ ] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [ ] All existing tests are passing. ## Summary by Sourcery Refactor dependency management to use weak references, preventing potential memory leaks and improving resource management across various managers in the AppFlowy application. Enhancements: - Replaced strong Arc references with Weak references in multiple managers to prevent circular references - Added helper methods to safely upgrade weak references with error handling - Implemented Drop trait for managers to log tracing information during object destruction Chores: - Updated multiple manager and service implementations to use weak references - Modified dependency resolution methods to work with weak references - Added error handling for reference upgrades --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 23:22:45 +00:00
Sign in to join this conversation.
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
AppFlowy-IO/AppFlowy#8131
No description provided.