-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
ConcurrentModificationException
when querying /v3/api-docs/{group}
concurrently for different groups.
#1641
Comments
Thank you for reporting this issue and your deeper analysis of the root cause. |
…ncurrently for different groups. Fixes #1641.
Thanks for such a quick turnaround, I've tried the snapshot and it has indeed fixed the issue. |
…ncurrently for different groups. Fixes #1641.
…-docs/{group} concurrently for different groups. #1641
Meet the same problem. When will a new release version be available? |
Updated to 1.6.9 but the problem persisted:
It seems that |
@bnasslahsen Can you please implement another fix for the problem? I thought synchronizing on the list might be a possible solution. eg: synchronized (HIDDEN_REST_CONTROLLERS) {
return HIDDEN_REST_CONTROLLERS.stream().anyMatch(clazz -> clazz.isAssignableFrom(rawClass));
} |
Please feel free to propose a PR. |
Describe the bug
After application startup, when querying
/v3/api-docs/{group}
concurrently for different groups, often an error is returned caused by:After some digging, it seems the problem lies within
GenericResponseService
:GenericResponseService
is a singleton service, andcontrollerAdviceInfos
is anArrayList
which is not thread safe, and it's being mutated at runtime by the service, therefore when concurrent requests come in,ConcurrentModificationException
could occur.The workaround that I currently have is to override
buildGenericResponse
andbuild
(the two methods that read/writecontrollerAdviceInfos
) to mark them assynchronized
to avoid concurrent access, which is possibly not the optimal solution:To Reproduce
Steps to reproduce the behavior:
2.6.7
spring-doc-openapi-ui 1.6.8
When query
/v3/api-docs/{group}
concurrently for different groups, some requests are failing due to the above error.Sorry have not had the time to do this, hopefully the description provides enough info.
Expected behavior
Able to query
/v3/api-docs/{group}
concurrently for different groups without error.The text was updated successfully, but these errors were encountered: