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

nil pointer panic when closing producer #50

Merged
merged 1 commit into from
Nov 1, 2017
Merged

Conversation

db7
Copy link
Collaborator

@db7 db7 commented Oct 29, 2017

This PR fixes #49. The issue is that we were closing the stop channel and the underlying producer at the same time. Since the select in run() is non-deterministic and the channels of the producer (errors and successes) may return nil if they are closed, sometimes the goroutine was getting a nil value back and trying to derefence the Metadata pointer.

We now first close the stop channel, that will force the goroutine in run() to exit. Afterwards, we close the underlying producer.

@db7 db7 changed the title fixes #49 nil pointer panic when closing producer Oct 29, 2017
@db7 db7 merged commit 070985f into master Nov 1, 2017
@db7 db7 deleted the fix-close-order-in-producer branch November 1, 2017 14:30
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

Successfully merging this pull request may close these issues.

panic: runtime error: invalid memory address or nil pointer dereference
2 participants