commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <>
Subject [jira] Resolved: (MATH-253) MathRuntimeException and MathException are both thread-hostile.
Date Sun, 05 Apr 2009 15:38:13 GMT


Luc Maisonobe resolved MATH-253.

    Resolution: Fixed
      Assignee: Luc Maisonobe

fixed in subversion repository as of r762107.
The cache has been removed completely, so the bundle is retrieved and used at each request.
Since this is only used when errors are triggered, there should not be any noticeable drop
in performance.
thanks fo the report.

> MathRuntimeException and MathException are both thread-hostile.
> ---------------------------------------------------------------
>                 Key: MATH-253
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>            Assignee: Luc Maisonobe
>             Fix For: 2.0
> MathRuntimeException and MathException are both thread-hostile.
> They have a mutable static field cachedResources which is used in performing translations.
> If two threads use different locales - which is highly likely in the case of non-US locales,
as some methods use Locale.US - then they may get corrupt or incorrect output.
> If a cache is really desired, it could either be ThreadLocal, or volatile, but it that
case the translate method needs to fetch the value once (and update it once if necessary).
> As it stands, the method can check the resource, find it is OK, then fetch it again to
use it, by which time it might have changed. Further, one thread may set the variable, and
another thread may see a partially constructed Resources object (it's not final).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message