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

Already on GitHub? Sign in to your account

libpcp: unlock context before returning #50

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

ryandoyle commented Nov 9, 2015

If called in a non-archive context, the context ctxp->lock c_lock is
never unlocked.

libpcp: unlock context before returning
If called in a non-archive context, the context ctxp->lock c_lock is
never unlocked.
Contributor

kmcdonell commented Nov 9, 2015

Looks good Ryan, thanks. I've pulled your commit into my tree and it will flow back to github via pcp.io in due course.

This is a pretty unlikely code path (calling pmGetArchiveLabel() when the current context is valid, but not an archive) and I would expect none of our code can actually be persuaded to do this, so I am curious if you actually observed the problem that this patch fixes, or noticed by code inspection, or have some devious test harness and lock audit tool that exposed the logic error.

Anyway, thanks for improving the correctness and robustness of the code.

@kmcdonell kmcdonell closed this Nov 9, 2015

Contributor

ryandoyle commented Nov 9, 2015

Hi Ken

Its true that its an unlikely code path. I discovered it while in the process of writing Ruby bindings (still a work in progress!). I have test cases for local and archive contexts which test both success and error conditions.

If you're interested, I have a WIP branch called ruby-bindings at https://github.com/ryandoyle/pcp

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