dgraph-io/dgraph · error

failed to run publisher: %v

Error message

failed to run publisher: %v

What it means

In streamInGroup, the publisher goroutine reads from the incoming StreamExtSnapshot stream and fans messages out to subscribers (local writer and forwarders). If ps.handlePublisher returns an error (e.g. failed Recv on the incoming stream other than EOF), it is wrapped as 'failed to run publisher: %v'.

Source

Thrown at worker/import.go:620

					return nil
				}

				updateNodeStatus(&ps.RWMutex, successfulNodes, member.Addr, true)
				glog.Infof("[import] Successfully connected and streamed data to node: %v", member.Addr)
				return nil
			})
		}
	}

	eg.Go(func() error {
		defer ps.close()
		defer func() {
			if err := stream.Send(&api.StreamExtSnapshotResponse{}); err != nil {
				glog.Errorf("[import] failed to send close on in: %v", err)
			}
		}()
		if err := ps.handlePublisher(errGCtx, stream); err != nil {
			return fmt.Errorf("failed to run publisher: %v", err)
		}
		return nil
	})

	if err := eg.Wait(); err != nil {
		return fmt.Errorf("failed to run in group streaming: %v", err)
	}
	// Sends a StreamExtSnapshotResponse with the Finish flag set to true to indicate
	// the completion of the streaming process. If an error occurs during the send
	// operation, it is returned for further handling.
	if err := stream.Send(&api.StreamExtSnapshotResponse{Finish: true}); err != nil {
		glog.Errorf("failed to send done signal: %v", err)
	}

	// If this node is the leader and fails to reach a majority of nodes, we return an error.
	// This ensures that the data is reliably received by enough nodes before proceeding.
	if forward && !checkMajority(successfulNodes) {
		glog.Error("[import] Majority of nodes failed to receive data.")

View on GitHub (pinned to 759e242be6)

Solutions

  1. Check the wrapped cause for the real transport error and fix connectivity between the importing client and this alpha.
  2. Retry the snapshot streaming from the beginning; errgroup aborts the whole stream.
  3. Check alpha logs for the paired subscriber/forwarder errors that may have canceled the shared errgroup context.
  4. Ensure the importing client is not timing out before the stream completes.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// verify client stability and connectivity before streaming
if err := pingAlpha(proxyAddr); err != nil { return err }

Try / catch

err := streamInGroupViaClient(ctx)
if err != nil && strings.Contains(err.Error(), "failed to run publisher") {
    root := errors.Unwrap(err)
    // root is the transport/recv error; retry whole stream after fixing it
}

Prevention

When it happens

Trigger: The client streaming into StreamExtSnapshot breaks mid-stream: Recv returns a transport error or the context is canceled; malformed/failed receive inside the publisher loop.

Common situations: dgraph live loader / client disconnected during bulk import; network drop between proxy alpha and this leader; stream canceled because another group member (subscriber/forwarder) failed first via errgroup context.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/10d357e574c99d71. Report an issue: GitHub.