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

OffsetManager.Close() race condition #656

Closed
hasnickl opened this issue May 5, 2016 · 0 comments · Fixed by #658
Closed

OffsetManager.Close() race condition #656

hasnickl opened this issue May 5, 2016 · 0 comments · Fixed by #658

Comments

@hasnickl
Copy link

hasnickl commented May 5, 2016

When closing OffsetManager, it can hang waiting for state to become "clean".

The Close method uses AsyncClose internally. At L360, AsyncClose waits for a message on the clean chan before closing the dying chan:

        pom.lock.Lock()
        dirty := pom.dirty
        pom.lock.Unlock()

        if dirty {
            <-pom.clean
        }

        close(pom.dying)

However, updateCommitted can execute between AsyncClose()'s pom.lock.Unlock() and receive on the clean chan:

    pom.lock.Lock()
    defer pom.lock.Unlock()
...
        select {
        case pom.clean <- none{}:
        default:
        }

The Close() method drains pom.errors at L371. This channel does not close until pom.dying is closed, which is selected in the mainLoop at L215

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