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

ASF subversion and git services commented on JSPWIKI-1178:
----------------------------------------------------------

Commit bb20405a48e4edfb521f6d2492a8c713ca728662 in jspwiki's branch 
refs/heads/master from Arturo Bernal
[ https://gitbox.apache.org/repos/asf?p=jspwiki.git;h=bb20405a4 ]

JSPWIKI-1178 Use ReentrantLock instead of synchronized to avoid virtual thread 
pinning

Replace synchronized blocks and methods that guard shared state with a
ReentrantLock, driven through the new Synchronizer helper, so that code
running on a virtual thread is not pinned to its carrier thread while it
waits for the lock or blocks inside the critical section.

The locks held by the serializable workflow classes are transient and
recreated on deserialization, so workflow data written by earlier
releases keeps loading.


> 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