You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Prakash Udupa (JIRA)" <de...@myfaces.apache.org> on 2014/06/20 06:53:25 UTC

[jira] [Created] (TRINIDAD-2484) Threadsafety issue in SkinStyleProvider leading to missing styles and distorted ui

Prakash Udupa created TRINIDAD-2484:
---------------------------------------

             Summary: Threadsafety issue in SkinStyleProvider leading to missing styles and distorted ui
                 Key: TRINIDAD-2484
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2484
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Skinning
    Affects Versions: 2.1.0-core
            Reporter: Prakash Udupa



We have seen that soon after server start, when there are almost concurrent requests from IE, in random occurrences, there will be only one link encoded in the HTML, while there are two css files generated. Consequently, styles for some components in the page could go missing, ending up in distorted UI in certain sections of the rendered page.

We suspect the cause to be a thread safety issue in SkinStyleProvider implementation where we construct style providers and save it in map keyed by skin and the directory path of the css. The issue is in _getProviders() implementation, where the variable _sSharedProviders is not accessed in threadsafe manner. This leads to possibility of the providers map being overwritten. This further leads to constructing two SkinStyleProviders for the same skin. While one request could use one provider (P1) that is in process of writing out one css file with the second one pending, there could be other request that ends up using a different provider (P2) that would see a single file written, and end up adding single URI in its Entry map. All requests later could end up using P2 and sufferring from only one link being rendered, while there are two stylesheets actually generated.

Proposed fix is to eliminate "_sSharedProviders", and instead use the application scoped concurrent map hanging off of request scope to store the provider map. We can then leverage on the putIfAbsent in there to ensure there is only one copy of providers map for an application.




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Re: [jira] [Created] (TRINIDAD-2484) Threadsafety issue in SkinStyleProvider leading to missing styles and distorted ui

Posted by Prakash Udupa <pr...@oracle.com>.
One of the contributors having write permission please commit the uploaded patch for this issue.

Thanks,
Prakash

On 6/19/2014 11:53 PM, Prakash Udupa (JIRA) wrote:
> Prakash Udupa created TRINIDAD-2484:
> ---------------------------------------
>
>               Summary: Threadsafety issue in SkinStyleProvider leading to missing styles and distorted ui
>                   Key: TRINIDAD-2484
>                   URL: https://issues.apache.org/jira/browse/TRINIDAD-2484
>               Project: MyFaces Trinidad
>            Issue Type: Bug
>            Components: Skinning
>      Affects Versions: 2.1.0-core
>              Reporter: Prakash Udupa
>
>
>
> We have seen that soon after server start, when there are almost concurrent requests from IE, in random occurrences, there will be only one link encoded in the HTML, while there are two css files generated. Consequently, styles for some components in the page could go missing, ending up in distorted UI in certain sections of the rendered page.
>
> We suspect the cause to be a thread safety issue in SkinStyleProvider implementation where we construct style providers and save it in map keyed by skin and the directory path of the css. The issue is in _getProviders() implementation, where the variable _sSharedProviders is not accessed in threadsafe manner. This leads to possibility of the providers map being overwritten. This further leads to constructing two SkinStyleProviders for the same skin. While one request could use one provider (P1) that is in process of writing out one css file with the second one pending, there could be other request that ends up using a different provider (P2) that would see a single file written, and end up adding single URI in its Entry map. All requests later could end up using P2 and sufferring from only one link being rendered, while there are two stylesheets actually generated.
>
> Proposed fix is to eliminate "_sSharedProviders", and instead use the application scoped concurrent map hanging off of request scope to store the provider map. We can then leverage on the putIfAbsent in there to ensure there is only one copy of providers map for an application.
>
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.2#6252)