question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PrimeApplicationContext is not thread safe

See original GitHub issue

1) Environment

  • PrimeFaces version: 7.0.RC3
  • Does it work on the newest released PrimeFaces version? No
  • Does it work on the newest sources in GitHub? No

2) Explanation

The PrimeApplicationContext is an application scoped object that is lazily initialized. However, its initialization is not protected by any synchronized blocks or other thread safety code. So if X threads call PrimeApplicationContext.getCurrentInstance(facesContext) at the same time, they may instantiate as many as X PrimeApplicationContext instances.

Another aspect of PrimeApplicationContext that isn’t thread safe is the lazy initialization of member data (such as VirusScanner). This article explains the issue in detail, but essentially the current implementation may allow threads to access partially initialized objects.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
tandraschkocommented, Mar 1, 2019

done! @stiemannkj1 @melloware @cnsgithub @jxmai @Rapster it would be great if you could give my changes a try in your applications, if everything works as expected before we release the final.

0reactions
stiemannkj1commented, Mar 1, 2019

@tandraschko just ran all the Faces tests and everything is working great!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is the following utility class thread-safe? - java - Stack Overflow
No. It's not thread safe. Writes to the context class variable are not guaranteed to be visible to threads that read that variable...
Read more >
Concurrent creation of the same Configuration class ... - GitHub
Vivien HENRIET opened SPR-10307 and commented The refresh() method of AnnotationConfigApplicationContext is not thread safe anymore. It works fine in 3.1.2.
Read more >
Spring Framework Reference Documentation - xy2401.github.io
Deploying a Spring ApplicationContext as a Java EE RAR file ... As of Spring 3.0, a thread scope is available, but is not...
Read more >
5 Ways to debug thread-safety issues in Java
Debugging concurrency issues are not easy. 5 Ways to debug Java thread-safety issues the tutorial style. You need top-notch developers.
Read more >
Core Technologies - Spring
ApplicationContext interface represents the Spring IoC container and is ... As of Spring 3.0, a thread scope is available but is not registered...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found