2 Common Concurrency Pitfalls in AEM and How to Avoid Them

Published on by Dan KlcoPicture of Me Dan Klco

Concurrency issues are both disastrous and difficult to detect in non-production loads. They are more difficult to reproduce than most bugs because they specifically rely on multiple operations happening at/around the same time, which is difficult to reproduce in a development or local environment. Since concurrency bugs are hard to find and diagnose, we should be vigilant to patterns which cause them and be especially careful in writing certain types of code, which is more likely to have concurrency issues. I've done a number of audits and hundreds of code reviews and there are two common patterns where concurrency issues are prevalent. They are: Member variables of OSGi Services Repository Updates in Workflows / Async-Tasks  Let's unpack each pattern, understand how it can lead to concurrency issues and discuss the concurrency-issue free replacement.   Member Variables in OSGi Services   In most Java coding, it's pretty safe to have member...

Tags