Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasionally, deadlocks occur when the main thread and asynchronous thread initialize the same Feign Api call #1354

Open
dongfangding opened this issue May 16, 2024 · 4 comments
Assignees

Comments

@dongfangding
Copy link

When I initiate a remote call for initialization using a Feign API in the main thread, and perform similar operations using the same Feign API in an asynchronous thread in the initialization of another class.
I am following org.springframework.cloud.context.named.NamedContextFactory#getContext obtains the lock, there will be a call to the context.refresh(), which in turn will contain another lock. At certain times, due to uncontrollable sequence, the main thread may experience a deadlock and fail to start.

Sample

@Component
Class A {
   @PostConstruct
   public void init() {
       // Feign Api remote call
   }
}

@Component
Class B {
   @PostConstruct
   public void init() {
       Executors.newSingleThreadExecutor().execute(() -> {
             // Same feign API calls
       });
   }
}
@OlgaMaciaszek
Copy link
Collaborator

Hello @dongfangding, I was not able to reproduce it. Could you provide more details, such as a thread dump?

@spring-cloud-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-cloud-issues
Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@dongfangding
Copy link
Author

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants