Feature/fix triple nonblocking stream close#3465
Closed
Vanillaxi wants to merge 6 commits into
Closed
Conversation
* stablize_register_services * imprt format
… state (apache#3353) (apache#3367) * feat(metadata): add internal RWMutex for MetadataInfo and fix json serialization (apache#3353) Add sync.RWMutex to MetadataInfo struct with json:"-" / hessian:"-" tags to skip serialization. All mutating methods (AddService, RemoveService, AddSubscribeURL, RemoveSubscribeURL) acquire the write lock, and read methods (GetExportedServiceURLs, GetSubscribedURLs, GetServices) acquire the read lock. The new GetServices method returns a snapshot copy. Signed-off-by: jieguo-coder <1193249232@qq.com> * feat(metadata): add lock protection for global registry and instances (apache#3353) Add sync.RWMutex to protect registryMetadataInfo in metadata.go and instances in report_instance.go. Extract getMetadataReportUnsafe helper to avoid reentrant RLock deadlock in GetMetadataReportByRegistry fallback. Fix nacos report_test to use pointer to MetadataInfo for json.Marshal. Signed-off-by: jieguo-coder <1193249232@qq.com> * feat(metadata): fix concurrency safety in listener callbacks and external calls (apache#3353) Add mutex locking to AddListenerAndNotify and RemoveListener to protect shared fields listeners and serviceUrls. Replace direct access to MetadataInfo.Services with safe GetServices method in OnEvent and convertV2 to prevent unprotected map reads. Signed-off-by: jieguo-coder <1193249232@qq.com> * style: format import blocks using dubbo-go imports-formatter Signed-off-by: jieguo-coder <1193249232@qq.com> * style: format metadata.go and report_instance.go to pass CI Signed-off-by: jieguo-coder <1193249232@qq.com> * fix(metadata): resolve data races pointed out in code review Signed-off-by: jieguo-coder <1193249232@qq.com> * test: fix failing tests and improve unit test coverage Signed-off-by: jieguo-coder <1193249232@qq.com> * test: fix testifylint error by avoiding require in goroutines Signed-off-by: jieguo-coder <1193249232@qq.com> * fix(metadata): deep copy ServiceInfo to prevent write-on-read data race and reduce lock granularity in report creation Signed-off-by: jieguo-coder <1193249232@qq.com> * chore: trigger CI re-run for codecov gpg issue * refactor(metadata): implement no-lock helper to fix data race and avoid deadlocks in ReplaceExportedServices Signed-off-by: jieguo-coder <1193249232@qq.com> * test: fix compilation error in instance changed listener tests by adding missing registryId argument Signed-off-by: jieguo-coder <1193249232@qq.com> * fix(metadata): add RLock around global map lookup in RemoveService and RemoveSubscribeURL to prevent concurrent map read/write Signed-off-by: jieguo-coder <1193249232@qq.com> --------- Signed-off-by: jieguo-coder <1193249232@qq.com>
…e#3371) * feat(metadata): add renew and GC policy for app-level metadata * fix ci * fix ci * fix review * fix nil * rebase develop, resolve conflicts, add units
…ache#3462) Investigate whether connect-go v1.19.2's fix for the concurrent Send + CloseAndReceive nil-pointer dereference (connectrpc/connect-go#919) applies to Dubbo-go's forked Triple runtime. duplexHTTPCall is not affected: newDuplexHTTPCall allocates the request-body io.Pipe at construction and never reassigns requestBodyWriter, so it is always non-nil and concurrent Write/CloseWrite are safe in any order. The upstream race, where the pipe was created lazily on the first Send and a racing CloseWrite could leave it nil, is structurally impossible here, so no synchronization change is ported. - add TestDuplexHTTPCallConcurrentWriteAndCloseWrite and TestDuplexHTTPCallConcurrentWriteCloseRace as regression guards (run under -race) that pin the construction-time pipe invariant - document the invariant on requestBodyWriter to keep the allocation out of a lazy/first-send path Ref: apache#3458
…F header (apache#3464) * fix(triple_protocol): replace Buf Technologies license header with ASF header - Replace Buf Technologies copyright header with Apache Software Foundation header in 55 Go files - Replace Buf Technologies copyright header in 4 proto files - Remove license-header tool from Makefile to prevent auto-generation of Buf headers - Remove COPYRIGHT_YEARS and LICENSE_IGNORE variables from Makefile This ensures all files have proper ASF license headers for Apache Dubbo project. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(triple_protocol): restore build constraints in maxbytes.go - Add //go:build go1.19 and // +build go1.19 constraints - Build constraints must precede license header per Go convention - Remove duplicate leftover license text lines Co-Authored-By: Claude <noreply@anthropic.com> * fix(triple_protocol): restore missing package declaration in triple_ext_test.go The package declaration was accidentally removed when replacing the license header. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3465 +/- ##
==========================================
+ Coverage 53.57% 53.91% +0.34%
==========================================
Files 460 461 +1
Lines 35182 35476 +294
==========================================
+ Hits 18847 19127 +280
+ Misses 14857 14844 -13
- Partials 1478 1505 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
duplexHTTPCall.CloseRead()to close the response body directly instead of draining the remaining response body first.duplexHTTPCall.Why
CloseRead()previously drained the remaining response body before closing it. If the server kept the response stream open, returned an error early, stopped reading the request side, or the transport stopped producing response bytes, client close paths such asServerStreamForClient.Close,BidiStreamForClient.CloseResponse, andClientStreamForClient.CloseAndReceivecould block unnecessarily.This selectively ports only the stream close lifecycle behavior from the connect-go v1.18.0 fix without bringing in unrelated connect-go features.
Fixes #3457
Tests