You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Sebastian Schlatow (Jira)" <ji...@apache.org> on 2025/11/14 13:16:00 UTC
[jira] [Commented] (BATIK-1271) [PATCH] Thread-safety issue in AWTGlyphGeometryCache causing infinite loop
[ https://issues.apache.org/jira/browse/BATIK-1271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18038341#comment-18038341 ]
Sebastian Schlatow commented on BATIK-1271:
-------------------------------------------
We are also facing this issue with Batik 1.16. I have created a pull request on GitHub with the patch from Fabien.
https://github.com/apache/xmlgraphics-batik/pull/66
> [PATCH] Thread-safety issue in AWTGlyphGeometryCache causing infinite loop
> --------------------------------------------------------------------------
>
> Key: BATIK-1271
> URL: https://issues.apache.org/jira/browse/BATIK-1271
> Project: Batik
> Issue Type: Bug
> Components: GVT
> Affects Versions: 1.9
> Reporter: Fabien Leroy
> Priority: Major
> Attachments: AWTGlyphGeometryCache.diff, heap dump.png, partial thread dump.txt
>
>
> Hello,
>
> Running Batik in a multi-threaded environment (JAVA EE application server), we are sometimes having threads stuck in infinite loop.
> Thread dump shows we are stucked in AWTGlyphGeometryCache.get() method.
> Heap dump shows we have an AWTGlyphGeometryCache$Entry instance that is referencing itself as ".next" item, resulting in an infinite loop when trying to run through the collection in AWTGlyphGeometryCache.get().
> Looking at the code, we found that the AWTGlyphGeometryCache.rehash() method is probably causing the problem : it is working on the 'table' class attribute and not on a copy. So if multiple threads enter this method concurrently, the following line may result in 'e.next = e' :
> {code:java}
> e.next = table[index];{code}
>
>
> Possible solutions that should work :
> # make the method synchronized
> # work on a local 'tmpTable', and assign it to the class attribute 'table' at the end of the method (cf suggested patch)
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org