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

gorouine leak when ReplaceLogger #86

Closed
timesking opened this issue May 21, 2015 · 4 comments
Closed

gorouine leak when ReplaceLogger #86

timesking opened this issue May 21, 2015 · 4 comments

Comments

@timesking
Copy link

Hi,

I just found asnLoopLogger.closed had never been set as true.
When I try to ReplaceLogger in runtime with new config each time, one more gorouine stuck in func processItem at asnLoopLogger.queueHasElements.Wait(). That introduce a gorouine dead wait.

Could you take a look and fix it?

func (asnLoopLogger *asyncLoopLogger) processItem() (closed bool) {
    asnLoopLogger.queueHasElements.L.Lock()
    defer asnLoopLogger.queueHasElements.L.Unlock()

    for asnLoopLogger.msgQueue.Len() == 0 && !asnLoopLogger.closed {
        asnLoopLogger.queueHasElements.Wait()
    }

    if asnLoopLogger.closed {
        return true
    }

    asnLoopLogger.processQueueElement()
    return false
}
@goodsign
Copy link
Collaborator

Hi timesking,

Could you please attach a full working example which reproduces this issue.

Thanks!

@timesking
Copy link
Author

I will do it later.

@goodsign
Copy link
Collaborator

Actually, I guess I know what the problem is. Please try the latest revision.

@timesking
Copy link
Author

I'm sure your commit has fixed my problem. Thx.

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

No branches or pull requests

2 participants