-
Notifications
You must be signed in to change notification settings - Fork 1.1k
ConcurrentModificationException for late-registered AbstractEndpoints #9878
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
Comments
probably it's already sufficient to just return a copy of the list for |
I think your:
is still valid use-case and it has nothing to do with testing or application shutdown. Such a bean registration during application shutdown has to fails somehow, e.g. with a:
But again: that is different story. I think we should rework Another side of the problem if we really need that Feel free to contribute the fix: https://github.com/spring-projects/spring-integration/blob/main/CONTRIBUTING.adoc! |
Thanks for already analyzing the issue! Failing at application shutdown would be great. but the Regarding the rework of Best regards! |
@artembilan , only listening for AbstractEndpoints before application context is fully initialized unfortunatelly is also not working 100%. I did miss to add another usecase: This then fails in the prepareTestInstance instead of afterTestClass I would like to contribute only a small change to MockIntegrationContext first: getAutoStartupCandidates should return a new ArrayList instead of the internal one. This would at least resolve the ConcurrentModificationException, while still not fully solving the underlying issue. What do you think about it? |
…ionListener Fixes: #9878 Issue link: #9878 * `return Collections.unmodifiableList(this.autoStartupCandidates);` in the `MockIntegrationContext` Signed-off-by: Alexander Hain <[email protected]> [[email protected] Improve commit message] Signed-off-by: Artem Bilan <[email protected]> (cherry picked from commit 3d16e59)
…ionListener Fixes: #9878 Issue link: #9878 * `return Collections.unmodifiableList(this.autoStartupCandidates);` in the `MockIntegrationContext` Signed-off-by: Alexander Hain <[email protected]> [[email protected] Improve commit message] Signed-off-by: Artem Bilan <[email protected]> (cherry picked from commit 3d16e59)
In what version(s) of Spring Integration are you seeing this issue?
6.4.2.RELEASE
Describe the bug
After executing a test, annotated with
@SpringBootTest
and@SpringIntegrationTest
, we saw aConcurrentModificationException
happening inSpringIntegrationTestExecutionListener
.The underlying issue was, that some logic added a new integrationFlow late (after application started). With bad timings, this happened exactly during
afterTestClass
execution currently looping through all AutoStartupCandidates, resulting in the exception.To Reproduce
Register a new bean, extending
AbstractEndpoint
withautostartup = true
exactly on test shutdown.Expected behavior
Probably only handle Autostartup candidates, that are received during the ApplicationContext initialization (stop adding Autostartup candidates after ApplicationStarted).
Sample
Sample project
The text was updated successfully, but these errors were encountered: