8000 Call SimpleArangoRepository.findAllById concurrent with trigger ConcurrentModificationException exception · Issue #302 · arangodb/spring-data · GitHub
[go: up one dir, main page]

Skip to content

Call SimpleArangoRepository.findAllById concurrent with trigger ConcurrentModificationException exception #302

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

Closed
totoroTree opened this issue Mar 27, 2024 · 2 comments
Assignees
Labels

Comments

@totoroTree
Copy link

When I try to build up an java app to retrieve data from ArangoDB, there was always an exception happen ConcurrentModificationException when calling SimpleArangoRepository.findAllById with concurrent workers, why? Is this meet expectation? Then what's the best practice to call the findAllById in concurrent environment?

The detailed call process is as following:
// the goal is to find whether the given items are already existing in the database or not. and this check would be called by multiple workers with different IDs.
List existingTiles = new ArrayList<>();
tileRepo.findAllById(tileIds.stream().map(String::valueOf).toList()).forEach(existingTiles::add);

The call stack for the exception is as following:
java.util.ConcurrentModificationException
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1229)
at com.arangodb.springframework.core.mapping.DefaultArangoPersistentEntity.findAnnotations(DefaultArangoPersistentEntity.java:269)
at com.arangodb.springframework.core.mapping.DefaultArangoPersistentEntity.getIndexes(DefaultArangoPersistentEntity.java:242)
at com.arangodb.springframework.core.mapping.DefaultArangoPersistentEntity.getPersistentIndexes(DefaultArangoPersistentEntity.java:210)
at com.arangodb.springframework.core.template.ArangoTemplate.ensureCollectionIndexes(ArangoTemplate.java:166)
at com.arangodb.springframework.core.template.ArangoTemplate._collection(ArangoTemplate.java:159)
at com.arangodb.springframework.core.template.ArangoTemplate._collection(ArangoTemplate.java:139)
at com.arangodb.springframework.core.template.ArangoTemplate._collection(ArangoTemplate.java:132)
at com.arangodb.springframework.core.template.ArangoTemplate.findAll(ArangoTemplate.java:484)
at com.arangodb.springframework.repository.SimpleArangoRepository.findAllById(SimpleArangoRepository.java:135)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)

@rashtao rashtao self-assigned this Mar 27, 2024
@rashtao rashtao added the bug label Apr 3, 2024
@rashtao
Copy link
Collaborator
rashtao commented Apr 3, 2024

Thanks for reporting, this is indeed a bug, fixed in d2b66b2

@rashtao
Copy link
Collaborator
rashtao commented Jun 21, 2024

@rashtao rashtao closed this as completed Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0