micro/go-micro · error
mdns: error sending multicast response: %v
Error message
mdns: error sending multicast response: %v
What it means
After resolving a query, handleQuery sends the multicast response via sendResponse. If that socket write fails, the underlying OS error is wrapped with this message. The unicast path has an analogous separate message.
Source
Thrown at internal/util/mdns/server.go:309
// 18.9: AD (Authentic Data) Bit
// 18.10: CD (Checking Disabled) Bit
// 18.11: RCODE (Response Code)
},
// 18.12 pertains to questions (handled by handleQuestion)
// 18.13 pertains to resource records (handled by handleQuestion)
// 18.14: Name Compression - responses should be compressed (though see
// caveats in the RFC), so set the Compress bit (part of the dns library
// API, not part of the DNS packet) to true.
Compress: true,
Question: query.Question,
Answer: answer,
}
}
if mresp := resp(false); mresp != nil {
if err := s.sendResponse(mresp, from); err != nil {
return fmt.Errorf("mdns: error sending multicast response: %v", err)
}
}
if uresp := resp(true); uresp != nil {
if err := s.sendResponse(uresp, from); err != nil {
return fmt.Errorf("mdns: error sending unicast response: %v", err)
}
}
return nil
}
// handleQuestion is used to handle an incoming question
//
// The response to a question may be transmitted over multicast, unicast, or
// both. The return values are DNS records for each transmission type.
func (s *Server) handleQuestion(q dns.Question) (multicastRecs, unicastRecs []dns.RR) {
records := s.config.Zone.Records(q)
if len(records) == 0 {
return nil, nilView on GitHub (pinned to 24529f1404)
Solutions
- Retry the mDNS exchange — the query source will typically re-query anyway
- Check interface state and logs for socket closure around the time of failure
- Ensure the server is not being stopped concurrently with query handling
- Inspect the wrapped OS error (ECONNREFUSED, ENETUNREACH, EAGAIN) for the root cause
Defensive patterns
Strategy: retry
Try / catch
if err := srv.handleQuery(query, from); err != nil {
if strings.Contains(err.Error(), "error sending multicast response") {
// transient send failure: safe to drop; querier will re-ask
log.Debugf("sendResponse failed (%v); ignoring", err)
return nil
}
return err
} Prevention
- Ensure the server outlives its sockets — avoid racing NewServer shutdown with packet handling
- Monitor interface state; re-create the server after NIC changes
- Don't alert on single send failures — mDNS retries are inherent to the protocol
When it happens
Trigger: s.sendResponse(mresp, from) returning an error during parsePacket-driven query handling — e.g. the response socket was closed, interface went down, or destination is unreachable.
Common situations: Interface flapping mid-operation; network namespace/container teardown while server is live; buffer/queue exhaustion on the UDP socket (EAGAIN under load); server being shut down concurrently.
Related errors
- failed to bind to any unicast udp port
- failed to bind to any multicast udp port
- [ERR] mdns: Failed to bind to any udp port
- mdns: error sending unicast response: %v
- failed to join multicast group on all interfaces
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/5eee6cdef7ac1605.
Report an issue: GitHub.