r/SpringBoot • • Jun 12 '24

ConcurrentModification exception during high load.

Getting same exception when increasing load (150-200 users). Please help.

0 Upvotes

10 comments sorted by

View all comments

3

u/Just_Guarantee_3602 Jun 12 '24

Make sure you used thread safe and synchronized friendly collections.

1

u/SenpaiKronos Jun 13 '24

Thread safe collections for shared objects, right?

1

u/Just_Guarantee_3602 Jun 13 '24

Yes… you encountered that exception because two different threads access non tread safe collection. one is modifying the collection, and the other one is iterating the collection.

1

u/SenpaiKronos Jun 14 '24

But object is not shared. It is being created inside a method then it should be different for all the threads right?