Skip to content

Conversation

@swarna1101
Copy link
Collaborator

@swarna1101 swarna1101 commented Jan 27, 2026

Summary by CodeRabbit

Release Notes

  • Chores
    • Updated Go toolchain from version 1.24.1 to 1.25.5
    • Upgraded linting tool from v2.0.1 to v2.8.0
    • Enhanced CI pipeline with additional build step visibility
    • Optimized connection handling for improved performance
    • Cleaned up project configuration files

✏️ Tip: You can customize this high-level summary in your review settings.

@swarna1101 swarna1101 requested a review from hpsing January 27, 2026 05:03
@swarna1101 swarna1101 linked an issue Jan 27, 2026 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

The PR updates Go toolchain versions across the codebase from 1.24.1 to 1.25.5, bumps CI linting tool version, refactors GRPC connection handling in the multi-publish client to reuse connections across iterations instead of recreating per-iteration, adds log file ignores, and cleans up module dependencies.

Changes

Cohort / File(s) Summary
Go Toolchain Version Updates
grpc_p2p_client/go.mod, grpc_proxy_client/go.mod, keygen/go.mod
Bumped Go version from 1.24.1 to 1.25.5 across three module files. keygen/go.mod additionally adds explicit require for github.com/libp2p/go-libp2p v0.24.0 and tidies up indirect transitive dependencies.
CI Configuration & Logging
.github/workflows/ci.yml
Bumped linter version from v2.0.1 to v2.8.0. Added user-facing echo messages after three build/test steps (Build Proxy Client, Build Key Generator, Test Key Generation) to indicate successful execution.
Build Configuration
.gitignore
Added new ignore rule to exclude all \*.log files from version control.
GRPC Client Refactoring
grpc_p2p_client/cmd/multi-publish/main.go
Refactored connection initialization to establish GRPC client connection and CommandStream once before the loop, then reuse across iterations instead of creating new connections per-iteration. Updated error handling to return errors within loop instead of fatal logs. Added deferred connection close and success log message upon connection. Changed header generation to string constant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • hpsing
  • paiva

Poem

🐰 With Go 1.25.5 we now hop faster,
Connections reused—no more disasters!
Log files ignored, dependencies tidy,
The rabbit approves—let's merge this nidy!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: reusing gRPC connections in multi-publish to prevent libp2p panic, which aligns with the primary architectural improvement in grpc_p2p_client/cmd/multi-publish/main.go.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
grpc_p2p_client/cmd/multi-publish/main.go (1)

79-84: Error return value is ignored, silently discarding connection and stream failures.

sendMessages returns an error, but the caller discards it. This means connection failures, stream errors, and context cancellations go unreported—undermining the PR's goal of fixing connection issues.

🔧 Proposed fix to handle the error
 		go func(ip string) {
 			defer wg.Done()
 			datasize := *dataSize
-			sendMessages(ctx, ip, datasize, *output != "", dataCh)
+			if err := sendMessages(ctx, ip, datasize, *output != "", dataCh); err != nil {
+				log.Printf("Error sending messages to %s: %v", ip, err)
+			}
 		}(ip)
🧹 Nitpick comments (3)
grpc_p2p_client/cmd/multi-publish/main.go (3)

106-110: Stream is never closed; consider calling CloseSend() after the loop.

For bidirectional gRPC streams, the client should call stream.CloseSend() when finished sending to properly signal the server. Without this, the server may not know the client is done, potentially causing resource leaks or hangs.

♻️ Proposed fix to close the stream
 	client := protobuf.NewCommandStreamClient(conn)
 	stream, err := client.ListenCommands(ctx)
 	if err != nil {
 		return fmt.Errorf("[%s] ListenCommands failed: %w", ip, err)
 	}
+	defer stream.CloseSend()

 	println(fmt.Sprintf("Connected to node at: %s…", ip))

112-112: Use fmt.Printf or log.Printf instead of println.

println is a built-in intended for bootstrapping/debugging, not production code. It writes to stderr and has inconsistent formatting across platforms.

♻️ Proposed fix
-	println(fmt.Sprintf("Connected to node at: %s…", ip))
+	log.Printf("Connected to node at: %s…", ip)

71-74: Simplify nested goroutine by removing unnecessary wrapper.

The outer goroutine only spawns an inner goroutine and exits immediately. This adds complexity without benefit.

♻️ Proposed simplification
 	if *output != "" {
 		done = make(chan bool)
-		go func() {
-			header := "sender\tsize\tsha256(msg)"
-			go shared.WriteToFile(ctx, dataCh, done, *output, header)
-		}()
+		header := "sender\tsize\tsha256(msg)"
+		go shared.WriteToFile(ctx, dataCh, done, *output, header)
 	}

@Taranpreet26311 Taranpreet26311 merged commit 8619d17 into main Jan 27, 2026
6 checks passed
@swarna1101 swarna1101 deleted the fix/libp2p-connection-reuse-panic branch January 27, 2026 10:07
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.

bug: libp2p error while multi-publish

3 participants