helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HELIX-584) SimpleDateFormat should not be used as singleton due to its race conditions
Date Fri, 20 Mar 2015 23:03:38 GMT

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

ASF GitHub Bot commented on HELIX-584:
--------------------------------------

GitHub user lei-xia opened a pull request:

    https://github.com/apache/helix/pull/20

    [HELIX-584] SimpleDateFormat should not be used as singleton due to its race conditions

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/lei-xia/helix helix-0.6.x

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/helix/pull/20.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #20
    
----
commit e924a4c4ee1f1c52dcf6b478bbc88d3050e9d0f8
Author: Lei Xia <lxia@linkedin.com>
Date:   2015-03-20T22:55:24Z

    [HELIX-584] SimpleDateFormat should not be used as singleton due to its race conditions.

----


> SimpleDateFormat should not be used as singleton due to its race conditions
> ---------------------------------------------------------------------------
>
>                 Key: HELIX-584
>                 URL: https://issues.apache.org/jira/browse/HELIX-584
>             Project: Apache Helix
>          Issue Type: Bug
>            Reporter: Lei Xia
>            Assignee: Lei Xia
>
> SimpleDateFormat is used in workflowConfig as a singleton. But since it is not thread-safe
(refer here: http://www.hpenterprisesecurity.com/vulncat/en/vulncat/java/race_condition_format_flaw.html),
it will mess up the output date format sometime due to race condition. 
> An example trace stack for such failure:
> Message:
> For input string: "2003.E2003E22"
> Full Stacktrace:
> java.lang.NumberFormatException: For input string: "2003.E2003E22"
> at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
> at java.lang.Double.parseDouble(Double.java:510)
> at java.text.DigitList.getDouble(DigitList.java:151)
> at java.text.DecimalFormat.parse(DecimalFormat.java:1302)
> at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1935)
> at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1311)
> at java.text.DateFormat.parse(DateFormat.java:335)
> at org.apache.helix.task.TaskUtil.parseScheduleFromConfigMap(TaskUtil.java:365)
> at org.apache.helix.task.WorkflowConfig$Builder.fromMap(WorkflowConfig.java:173)
> at org.apache.helix.task.TaskUtil.getWorkflowCfg(TaskUtil.java:113)
> at org.apache.helix.task.TaskUtil.getWorkflowCfg(TaskUtil.java:126)
> at org.apache.helix.integration.task.TestUtil.pollForJobState(TestUtil.java:61)
> at org.apache.helix.integration.task.TestTaskRebalancerStopResume.stopDeleteJobAndResumeRecurrentQueue(TestTaskRebalancerStopResume.java:420)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76)
> at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
> at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
> at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
> at org.testng.TestRunner.privateRun(TestRunner.java:749)
> at org.testng.TestRunner.run(TestRunner.java:600)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
> at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312)
> at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274)
> at org.testng.SuiteRunner.run(SuiteRunner.java:223)
> at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
> at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
> at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039)
> at org.testng.TestNG.runSuitesLocally(TestNG.java:964)
> at org.testng.TestNG.run(TestNG.java:900)
> at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)
> at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
> at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
> at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
> at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
> at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
> at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message