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

long lived resolver crashes randomly, fix included #113

Open
quintilation opened this issue Jan 24, 2023 · 0 comments
Open

long lived resolver crashes randomly, fix included #113

quintilation opened this issue Jan 24, 2023 · 0 comments

Comments

@quintilation
Copy link

Hi,

I am using a long lived resolver which sometimes generates "write on closed channel" panics.

The fix below just copies the pattern from the stopProbing channel:

diff --git a/service.go b/service.go
index 6253c54..42ab5bd 100644
--- a/service.go
+++ b/service.go
@@ -72,7 +72,8 @@ type lookupParams struct {

isBrowsing  bool
stopProbing chan struct{}
  • once sync.Once
  • noMore sync.Once
  • stop sync.Once
    }

// newLookupParams constructs a lookupParams.
@@ -91,11 +92,11 @@ func newLookupParams(instance, service, domain string, isBrowsing bool, entries
// Notify subscriber that no more entries will arrive. Mostly caused
// by an expired context.
func (l *lookupParams) done() {

  • close(l.Entries)
  • l.noMore.Do(func() { close(l.Entries) })
    }

func (l *lookupParams) disableProbing() {

  • l.once.Do(func() { close(l.stopProbing) })
  • l.stop.Do(func() { close(l.stopProbing) })
    }

// ServiceEntry represents a browse/lookup result for client API.

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

1 participant