Lcos-000 opened a new pull request, #3870:
URL: https://github.com/apache/dubbo-go/pull/3870

   Fixes #3865
   
   ### Root cause
   
   The file config center ignored errors returned by `fsnotify.NewWatcher()`.
   When watcher initialization failed, it continued with a nil watcher and 
started
   the event goroutine, which could panic while reading `watch.Events`.
   
   ### Changes
   
   - Return watcher initialization errors from `NewCacheListener`.
   - Propagate the error through the file configuration factory.
   - Start the watcher goroutine and register the shutdown callback only after
     successful watcher creation.
   - Make `Close` safe for nil and zero-value listeners, and safe to call
     repeatedly.
   - Add Linux regression coverage for file-descriptor exhaustion and verify 
that
     no shutdown callback is registered after initialization failure.
   
   ### Testing
   
   Passed:
   
   - `go test ./config_center/file -run 
'^(TestCacheListenerWatcherInitFailure|TestCacheListenerCloseNilSafe)$' 
-count=1`
   - `go test -race ./config_center/file -run 
'^(TestCacheListenerWatcherInitFailure|TestCacheListenerCloseNilSafe)$' 
-count=1`
   - `go vet ./config_center/file`
   - `go build ./config_center/file`
   - Targeted `gofmt` and `git diff --check`
   
   Attempted but environment-blocked:
   
   - `make test`: the environment had 176 inotify instances for the current 
user,
     while the system limit was 128; the full test also lacked three OTLP 
modules
     while `GOPROXY=off`.
   - `make check-fmt`: detected the unrelated pre-existing file
     `cluster/router/script/instance/js_instance_test.go`.
   
   ### Checklist
   
   - [x] I confirm the target branch is `develop`
   - [ ] I have run `make fmt` to format my code
   - [ ] I have run `make test` to run local tests
   - [x] I have added tests that prove my fix is effective
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to