Skip to content

long lived resolver crashes randomly, fix included #113

@quintilation

Description

@quintilation

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions