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

Connection should be correctly closed even if the pool is closed #1

Closed
monnand opened this issue Oct 4, 2013 · 2 comments
Closed
Labels

Comments

@monnand
Copy link
Member

monnand commented Oct 4, 2013

If the pool is closed, then closing a connection (which was get from the closed pool) will lead to a panic.

@monnand
Copy link
Member Author

monnand commented Oct 4, 2013

The following code will trigger this bug ( fakeConnManager is defined in pool_test.go ):

func TestCloseConnAfterClosingPool(t *testing.T) {
    max := 10
    manager := &fakeConnManager{nil, nil}
    pool := NewPool(max, max, manager)
    c, err := pool.Get()
    if err != nil {
            t.Errorf("Error: %v", err)
    }   

    if c == nil {
            t.Errorf("nil conn")
    }   
    // Close the pool first.
    pool.Close()

    // Then close the connection
    c.Close()
}

@monnand
Copy link
Member Author

monnand commented Oct 5, 2013

fix uniqush/uniqush-push#37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant