Skip to content

Conversation

@AlinsRan
Copy link
Contributor

@AlinsRan AlinsRan commented Aug 27, 2025

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches
  • Documentation
  • Refactor
  • Chore
  • CI/CD or Tests

What this PR does / why we need it:

Returning directly when an error occurs may result in the lock not being released.

d.mu.Lock()
deleteConfigs := d.ConfigManager.Update(args.Key, args.Configs)
for _, config := range deleteConfigs {
if err := d.Store.Delete(config.Name, args.ResourceTypes, args.Labels); err != nil {
log.Errorw("failed to delete resources from store",
zap.String("name", config.Name),
zap.Error(err),
)
return err

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@AlinsRan AlinsRan force-pushed the fix/adcclient-deadlock branch from 7eeaa8b to fec5508 Compare August 27, 2025 07:43
@AlinsRan AlinsRan marked this pull request as ready for review August 27, 2025 07:44
@AlinsRan AlinsRan requested a review from Copilot August 27, 2025 09:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a deadlock issue in the Apache APISIX Ingress Controller by refactoring the client update methods to ensure proper mutex unlocking when errors occur. The change extracts the store operations into a separate method with proper defer unlock pattern.

  • Refactored Update, Delete, UpdateConfig, and DeleteConfig methods to use a common pattern
  • Introduced applyStoreChanges method with proper mutex handling using defer unlock
  • Created StoreDelta struct to track applied and deleted configurations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@ronething ronething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@AlinsRan AlinsRan merged commit 07672cc into apache:master Aug 28, 2025
22 checks passed
@AlinsRan AlinsRan deleted the fix/adcclient-deadlock branch August 28, 2025 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants