[ 
https://issues.apache.org/jira/browse/JSPWIKI-1178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135867#comment-18135867
 ] 

Arturo Bernal commented on JSPWIKI-1178:
----------------------------------------

A pull request is open: https://github.com/apache/jspwiki/pull/307, rebased on 
the current master. It replaces the synchronized blocks and methods that guard 
shared state with a ReentrantLock, used through a new Synchronizer helper, so 
that code on a virtual thread is not pinned to its carrier thread while it 
waits for a lock. SynchronizerTest passes on its branch (5 tests) and does not 
pass on master, where the class does not exist. There is no test that 
reproduces the pinning itself.

> Deadlock with Java Virtual Threads
> ----------------------------------
>
>                 Key: JSPWIKI-1178
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-1178
>             Project: JSPWiki
>          Issue Type: Improvement
>            Reporter: Arturo Bernal
>            Assignee: Arturo Bernal
>            Priority: Minor
>              Labels: pull-request-available
>
> With the upcoming release of JDK 21, it's anticipated that a new feature 
> called "Virtual Threads" will be included. This feature may introduce a 
> potential deadlock issue in  JSPWiki application, particularly when blocking 
> operations occur within {{synchronized}} blocks/methods. In such cases, the 
> platform thread associated with a virtual thread may become "pinned" and 
> unavailable to execute other virtual threads.
> This ticket aims to:
>  # Investigate if and how the JSPWiki application might be affected by this 
> change in JDK 21's Virtual Threads.
>  # If found to be at risk of the aforementioned deadlock situation, propose 
> and implement changes to address this issue, ensuring the application's 
> stability and performance aren't compromised.
> *Steps to Reproduce:*
> While this issue isn't currently reproducible as JDK 21 hasn't been released 
> yet, potential risk areas in the application code can be identified by 
> looking for {{synchronized}} blocks/methods that contain blocking operations.
> *Suggested Actions:*
>  # Conduct an audit of the ScanPro application's source code to identify any 
> {{synchronized}} blocks/methods that may contain blocking operations.
>  # Analyze the potential impact of the "Virtual Threads" feature on these 
> code segments.
>  # If a risk of deadlock is identified, explore alternative solutions or 
> workarounds. This could involve refactoring the code, using different 
> concurrency controls, or adjusting the usage of resources.
>  # Test these changes thoroughly in a controlled environment before deploying 
> them to production.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to