[ 
https://issues.apache.org/jira/browse/STORM-3624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ethan Li updated STORM-3624:
----------------------------
    Component/s: storm-server

> Race condition on ArtifactoryConfigLoader.load
> ----------------------------------------------
>
>                 Key: STORM-3624
>                 URL: https://issues.apache.org/jira/browse/STORM-3624
>             Project: Apache Storm
>          Issue Type: Bug
>          Components: storm-server
>            Reporter: Ethan Li
>            Assignee: Ethan Li
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.3.0
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> https://github.com/apache/storm/blob/master/storm-server/src/main/java/org/apache/storm/scheduler/resource/ResourceAwareScheduler.java#L100-L102
> config() is called in multiple threads. But ArtifactoryConfigLoader.load is 
> not thread-safe. For example, 
> https://github.com/apache/storm/blob/master/storm-server/src/main/java/org/apache/storm/scheduler/utils/ArtifactoryConfigLoader.java#L181-L187
> {code:java}
> JSONObject returnValue;
>         try {
>             returnValue = (JSONObject) jsonParser.parse(metadataStr);
>         } catch (ParseException e) {
>             LOG.error("Could not parse JSON string {}", metadataStr, e);
>             return null;
>         }
> {code}
> Multiple threads use the same jsonParser and since JsonParser is not 
> thread-safe, the return value will be corrupted. 
> I propose to create a separate thread to load scheduler configs periodically. 
> This also makes the config loading logic cleaner.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to