Skip to content

Conversation

@Gitter499
Copy link
Contributor

@Gitter499 Gitter499 commented Jun 23, 2025

Notes

Moved around some of the Error types from Tree to make TreeError. Added -Zdylib-lto flag to env.rs which makes build noticeably slower but is required for some procedural macros being utilized in the thiserror_no_std crate.

TODO

Due to lots of error nesting, it is a little bit tedious to write out Errors. Thinking about refactoring with specialized macros to make error handling less tedious.

Closes #42

@Gitter499 Gitter499 requested a review from icmccorm June 23, 2025 19:14
@Gitter499 Gitter499 self-assigned this Jun 23, 2025
@Gitter499 Gitter499 added the good first issue Good for newcomers label Jun 23, 2025
Comment on lines 101 to 103
// Dropping the tree lock early as we already have our tree_ptr
// TODO: Validate that this drop does not lose us access to the tree pointer
core::mem::drop(tree_lock);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly induces a race condition

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to hold onto the lock until after we finish with the BorrowTracker object---that way, other threads will be held up within BorrowTracker::new until the current execution finishes modifying the Tree.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, instead of manually calling core::mem::drop, we'd just have another field within BorrowTracker.

Comment on lines 101 to 103
// Dropping the tree lock early as we already have our tree_ptr
// TODO: Validate that this drop does not lose us access to the tree pointer
core::mem::drop(tree_lock);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to hold onto the lock until after we finish with the BorrowTracker object---that way, other threads will be held up within BorrowTracker::new until the current execution finishes modifying the Tree.

Comment on lines 101 to 103
// Dropping the tree lock early as we already have our tree_ptr
// TODO: Validate that this drop does not lose us access to the tree pointer
core::mem::drop(tree_lock);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, instead of manually calling core::mem::drop, we'd just have another field within BorrowTracker.

prov: &'a Provenance,
ctx: &'a GlobalCtx,
allocator: BsanAllocHooks,
alloc_info: &'a mut AllocInfo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not safe to have this as a mutable borrow; even though we're locking the Tree, other threads can still potentially read the AllocInfo object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create an error.rs with custom BsanError enum and BsanWrapper trait (maybe?) to handle Results, program termination, and error handling

3 participants