[grpc logger] reduce GRPC log level by default for tests#95
Conversation
a51d4bd to
99f99f8
Compare
|
Changes unknown |
99f99f8 to
7340a7a
Compare
d8c1a7e to
9c1a985
Compare
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
9c1a985 to
bc67788
Compare
cendhu
left a comment
There was a problem hiding this comment.
Bob's Review Summary
This PR correctly identifies and fixes two race conditions while improving test infrastructure. The changes are well-executed and safe to merge.
✅ Key Strengths
- Accurate Root Cause Analysis: Both race conditions (test variable shadowing + gRPC logger initialization) are correctly identified and fixed at the source
- Comprehensive Fix: Removes the problematic
util.MustGetLoggerwrapper that caused concurrentgrpclog.SetLoggerV2()calls - Mechanical Refactoring: 50+ files updated consistently to use
flogging.MustGetLogger()directly - Improved Test Infrastructure:
- Adds
-raceflag for race detection - Splits CI into
test-raceandtest-coverjobs for better performance - Replaces
gotestfmtwith more moderngotestsum
- Adds
- No Breaking Changes: All changes are internal (test infrastructure + logging initialization)
🔍 Technical Analysis
Race #1 - Test Variable Shadowing (tools/cryptogen/csp_test.go):
- Problem: Parallel subtests shared parent-scope
errvariable - Fix: Changed to
loadErr :=for local scope per subtest - Why it works: Each parallel subtest now operates on independent memory
Race #2 - gRPC Logger Initialization:
- Problem:
grpclog.SetLoggerV2()is not thread-safe; called on every logger creation - Fix: Deleted
common/util/logging.gowrapper; useflogging.MustGetLogger()directly - Why it works:
flogging.MustGetLogger()is thread-safe; GRPC log level now set via env var at startup
📊 Impact Assessment
- Security: No security impact; fixes improve system reliability
- Performance: No runtime impact; minor test overhead from
-raceflag (mitigated by separate CI job) - Architecture: Simplifies dependency graph by removing unnecessary wrapper
- Documentation: No updates needed (internal changes only)
✅ Recommendation: APPROVE
The PR is ready to merge. All changes are correct, well-tested, and improve code quality.
Post-merge monitoring: Watch for any new race conditions in subsequent PRs; verify test execution time remains acceptable.
Full detailed review available in: PR_95_REVIEW.md
cendhu
left a comment
There was a problem hiding this comment.
Detailed inline review comments on key changes
| branches: [ "**" ] | ||
|
|
||
| env: | ||
| FABRIC_LOGGING_SPEC: info:grpc=error |
There was a problem hiding this comment.
While running test locally, should we set this env explicitly or set by make target?
There was a problem hiding this comment.
I set it manually. The same way I set export DB_DEPLOYMENT=local for my test env.
Type of change
Description
-raceflag for the tests and fix the race conditionsgotestsumto shorten the logsRoot Cause Analysis: Two Data Races Fixed by This PR
1. Test Data Race in
TestLoadPrivateKey_BadPEMerrvariable_, err =to_, loadErr :=to create local variable per subtest2. gRPC Logger Initialization Race
grpclog.SetLoggerV2()is not thread-safe; multiple goroutines could call it concurrently during package initializationRelated issues