Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WT-2573: free of stack-allocated WT_REF #2682

Merged
merged 1 commit into from Apr 21, 2016
Merged

Conversation

keithbostic
Copy link
Contributor

Ready for review/merge.

The error path in __wt_split_rewrite can free a WT_REF that was allocated
on the stack. Allocate the WT_REF instead, rewriting pages in memory isn't
a performance path, and it's a simple solution.

This change means we have never exercised this error path before. This is
an in-memory run which we've recently added to normal stress testing, but
I'm concerned about this, it seems unlikely a page-rewrite would fail in
normal testing.

Also fix a bug found by inspection, we weren't freeing allocated WT_REF
structures that didn't also have associated page images, which could lead
to memory leaks. There are failure cases where we would have allocated a
WT_REF and either not yet attached a page image or, in some cases, there's
no page image to attach. I'm calling the underlying __wt_free_ref() function
to free the WT_REF structure even when there's no associated page: that
looks safe, but regardless, I want to fix that function if this change fails,
not expicitly freeing the WT_REF structure in the split code.
@keithbostic keithbostic self-assigned this Apr 21, 2016
@sueloverso
Copy link
Member

Thanks! LGTM.

@sueloverso sueloverso merged commit 828567c into develop Apr 21, 2016
@sueloverso sueloverso deleted the wt-2573-wt-ref-free branch April 21, 2016 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants