You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Gleiphir2769 (via GitHub)" <gi...@apache.org> on 2023/03/21 13:21:43 UTC

[GitHub] [pulsar-client-go] Gleiphir2769 opened a new pull request, #996: [fix]: Fix panic caused by retryAssert()

Gleiphir2769 opened a new pull request, #996:
URL: https://github.com/apache/pulsar-client-go/pull/996

   ### Motivation
   
   retryAssert() will cause panic when assert failed.
   
   For example.
   
   ```
   func TestRetryAssert(t *testing.T) {
   	retryAssert(t, 5, 200, func() {}, func(t assert.TestingT) bool {
   		return assert.Equal(t, 1, 12)
   	})
   }
   ```
   
   Result.
   
   ```
   === RUN   TestRetryAssert
   --- FAIL: TestRetryAssert (0.20s)
   panic: runtime error: invalid memory address or nil pointer dereference [recovered]
   	panic: runtime error: invalid memory address or nil pointer dereference
   [signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x1047ffe40]
   ```
   
   This is because when assert failed, t.Errorf() will be invoked. However, retryAssert passed a nil value.
   
   https://github.com/apache/pulsar-client-go/blob/04ad521e6d061768ff02ac9bf024932d45b2bd94/pulsar/helper_for_test.go#L180
   
   ### Modifications
   
   - Fix retryAssert() to avoid panic()
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] shibd merged pull request #996: [fix]: Fix panic caused by retryAssert()

Posted by "shibd (via GitHub)" <gi...@apache.org>.
shibd merged PR #996:
URL: https://github.com/apache/pulsar-client-go/pull/996


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org