nodece commented on code in PR #1338:
URL: https://github.com/apache/pulsar-client-go/pull/1338#discussion_r1972750840


##########
pulsar/internal/connection.go:
##########
@@ -501,11 +511,20 @@ func (c *connection) WriteData(data Buffer) {
 
 }
 
-func (c *connection) internalWriteData(data Buffer) {
+func (c *connection) internalWriteData(ctx context.Context, data Buffer) {
        c.log.Debug("Write data: ", data.ReadableBytes())
-       if _, err := c.cnx.Write(data.ReadableSlice()); err != nil {
-               c.log.WithError(err).Warn("Failed to write on connection")
-               c.Close()
+       if ctx == nil {
+               return

Review Comment:
   Please check 
https://github.com/apache/pulsar-client-go/actions/runs/13538441376/job/37836739015
   
   ```
   2025-02-26T08:20:54.6856030Z     producer_test.go:475: 
   2025-02-26T08:20:54.6856682Z                 Error Trace:    
/pulsar/pulsar-client-go/pulsar/producer_test.go:475
   2025-02-26T08:20:54.6857513Z                 Error:          Expected nil, 
but got: &errors.errorString{s:"request timed out"}
   2025-02-26T08:20:54.6858292Z                 Test:           
TestFlushInPartitionedProducer
   2025-02-26T08:20:54.6858745Z --- FAIL: TestFlushInPartitionedProducer 
(30.02s)
   2025-02-26T08:20:54.6859183Z panic: runtime error: invalid memory address or 
nil pointer dereference [recovered]
   2025-02-26T08:20:54.6859909Z         panic: runtime error: invalid memory 
address or nil pointer dereference
   2025-02-26T08:20:54.6860253Z [signal SIGSEGV: segmentation violation 
code=0x1 addr=0x0 pc=0x12c4163]
   2025-02-26T08:20:54.6860265Z 
   2025-02-26T08:20:54.6860426Z goroutine 14599 [running]:
   2025-02-26T08:20:54.6860710Z testing.tRunner.func1.2({0x1505d80, 0x1ef9000})
   2025-02-26T08:20:54.6860964Z         /pulsar/go/src/testing/testing.go:1632 
+0x3fc
   2025-02-26T08:20:54.6861127Z testing.tRunner.func1()
   2025-02-26T08:20:54.6861355Z         /pulsar/go/src/testing/testing.go:1635 
+0x6b6
   2025-02-26T08:20:54.6861512Z panic({0x1505d80?, 0x1ef9000?})
   2025-02-26T08:20:54.6861720Z         /pulsar/go/src/runtime/panic.go:785 
+0x132
   2025-02-26T08:20:54.6862233Z 
github.com/apache/pulsar-client-go/pulsar.TestFlushInPartitionedProducer(0xc000374000)
   2025-02-26T08:20:54.6862565Z         
/pulsar/pulsar-client-go/pulsar/producer_test.go:476 +0x343
   2025-02-26T08:20:54.6862751Z testing.tRunner(0xc000374000, 0x16a9940)
   2025-02-26T08:20:54.6862985Z         /pulsar/go/src/testing/testing.go:1690 
+0x227
   2025-02-26T08:20:54.6863352Z created by testing.(*T).Run in goroutine 1
   2025-02-26T08:20:54.6863588Z         /pulsar/go/src/testing/testing.go:1743 
+0x826
   2025-02-26T08:20:54.6863859Z FAIL    
github.com/apache/pulsar-client-go/pulsar       285.026s
   ```
   
   Please remove this check.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to