← Back to Pull requests

fix(jindo): remove duplicate send on MetadataSyncDoneCh in jindocache and jindofsx #6298

Open
unknown opened this pull request with 318 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 26, 2026 14:00 UTC
Author

Ⅰ. Describe what this PR does

Removes the duplicate unguarded channel send resultChan <- result after base.SafeSend(resultChan, result) in syncMetadataInternal() for both JindoCacheEngine (pkg/ddc/jindocache/metadata.go) and JindoFSxEngine (pkg/ddc/jindofsx/metadata.go), and drops the leftover resultChan <- result inside the disabled comment block in pkg/ddc/jindo/metadata.go.

Previously, because MetadataSyncDoneCh is unbuffered and the receiver reads at most once before setting e.MetadataSyncDoneCh = nil, the second send blocked the goroutine forever on every completed metadata sync, leaking a goroutine and bypassing defer base.SafeClose(resultChan). Removing the duplicate send ensures each completed sync sends once via base.SafeSend, closes resultChan, and exits cleanly.

(Note: in jindocache and jindofsx, nothing outside the sync goroutine currently closes MetadataSyncDoneCh, so the goroutine leak is the reachable failure mode here; closing MetadataSyncDoneCh on shutdown like alluxio/vineyard is tracked in #6308.)

Ⅱ. Does this pull request fix one issue?


fixes #6297

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.


  • Added shared helper VerifyMetadataSyncChannelClosedOnce in pkg/utils/testutil/metadata_sync.go

  • Added focused TestSyncMetadataInternalChannelLifecycle in pkg/ddc/jindocache/metadata_test.go and pkg/ddc/jindofsx/metadata_test.go to verify that starting with MetadataSyncDoneCh == nil initializes the channel, clears it on follow-up sync, and closes the channel cleanly without blocking on a duplicate send.
  • Ⅳ. Describe how to verify it


    Run the unit tests for testutil, jindocache, jindofsx, and jindo:
    FLUID_UNIT_TEST=true go test -gcflags="all=-N -l" ./pkg/utils/testutil/... ./pkg/ddc/jindocache/... ./pkg/ddc/jindofsx/... ./pkg/ddc/jindo/...
    go test -race -v ./pkg/ddc/jindocache -run TestSyncMetadataInternalChannelLifecycle
    go test -race -v ./pkg/ddc/jindofsx -run TestSyncMetadataInternalChannelLifecycle
    

    Ⅴ. Special notes for reviews


  • Updated per review feedback on #6298:

  • - Clarified the reachable failure mode (goroutine leak on completed metadata sync).
    - Split TestSyncMetadataInternalChannelLifecycle into a dedicated test function in both engines.
    - Dropped dead resultChan <- result residue in pkg/ddc/jindo/metadata.go.
    - Matches the SafeSend-only pattern already used in alluxio, jindo, juicefs, and thin (#2536).

    Diff: 318 lines (+238 / -80) across 3 files Reviewer: cheyang Review duration: 6296m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 318 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #6298"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.5% · Safe to merge
    21.5%