Skip to content

Synchronize the cursor returned by followJournal#31263

Merged
LK4D4 merged 1 commit into
moby:masterfrom
nalind:journal-doublefree
Feb 23, 2017
Merged

Synchronize the cursor returned by followJournal#31263
LK4D4 merged 1 commit into
moby:masterfrom
nalind:journal-doublefree

Conversation

@nalind

@nalind nalind commented Feb 22, 2017

Copy link
Copy Markdown
Contributor

Make sure that the cursor value returned by followJournal() is the last of the values returned by its goroutine's calls to drainJournal() by waiting for the goroutine to explicitly send the intended value back to its caller. Previously, if followJournal() signalled the goroutine that its work was done by closing a pipe, depending on scheduling, it was possible for followJournal() to return a value which the goroutine would also pass to drainJournal(), which would free the value and allocate another one.

Along with #31231, this may be part of the cause for #30433.

Make sure that the cursor value returned by followJournal() is the last
of the values returned by its goroutine's calls to drainJournal() by
waiting for it, rather than returning a value that may be superceded by
another if we're singalling the goroutine that it should exit by closing
a pipe.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

@mlaventure mlaventure left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tiborvass

Copy link
Copy Markdown
Contributor

LGTM

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