[jira] [Commented] (HELIX-584) SimpleDateFormat should not be used as singleton due to its race conditions
[ https://issues.apache.org/jira/browse/HELIX-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14513592#comment-14513592 ] Hudson commented on HELIX-584: -- SUCCESS: Integrated in helix #1324 (See [https://builds.apache.org/job/helix/1324/]) [HELIX-584] SimpleDateFormat should not be used as singleton due to its race conditions. (lxia: rev a29ac9fb35365d1fe8cf12ef95c58643a5fea36b) * helix-core/src/main/java/org/apache/helix/task/WorkflowConfig.java * helix-core/src/main/java/org/apache/helix/task/TaskDriver.java * helix-core/src/main/java/org/apache/helix/task/TaskUtil.java 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)
[jira] [Commented] (HELIX-584) SimpleDateFormat should not be used as singleton due to its race conditions
[ https://issues.apache.org/jira/browse/HELIX-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14513347#comment-14513347 ] ASF GitHub Bot commented on HELIX-584: -- GitHub user lei-xia opened a pull request: https://github.com/apache/helix/pull/24 [HELIX-584] SimpleDateFormat should not be used as singleton due to its race conditions [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 master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/helix/pull/24.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 #24 commit a29ac9fb35365d1fe8cf12ef95c58643a5fea36b Author: Lei Xia l...@linkedin.com Date: 2015-04-27T00:25:33Z [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
[jira] [Commented] (HELIX-584) SimpleDateFormat should not be used as singleton due to its race conditions
[ https://issues.apache.org/jira/browse/HELIX-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14513557#comment-14513557 ] ASF GitHub Bot commented on HELIX-584: -- Github user kanakb commented on the pull request: https://github.com/apache/helix/pull/24#issuecomment-96513218 thanks! 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)
[jira] [Commented] (HELIX-584) SimpleDateFormat should not be used as singleton due to its race conditions
[ https://issues.apache.org/jira/browse/HELIX-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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 l...@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