You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2014/04/09 20:29:41 UTC
[1/3] git commit: Fix race condition in Time.java
Repository: incubator-storm
Updated Branches:
refs/heads/master eb3ecb37a -> 89e2fbbdb
Fix race condition in Time.java
Some of my test runs were occasionally failing with a NullPointerException on `backtype.storm.utils.Time.java:64`.
After a bit of investigation, it seems there's a race condition here; if we disable simulating mode while a thread is currently sleeping, then when it wakes up it won't re-check if it's still in "simulating" mode, it'll try to remove the sleep time, and get the NPE.
Refs [STORM-260](https://issues.apache.org/jira/browse/STORM-260).
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/28e65a82
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/28e65a82
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/28e65a82
Branch: refs/heads/master
Commit: 28e65a82bfcd60f38c93115974f6a8653756f9b5
Parents: d5dee0e
Author: Adrian Petrescu <ap...@gmail.com>
Authored: Fri Mar 21 17:17:40 2014 -0400
Committer: Adrian Petrescu <ap...@gmail.com>
Committed: Fri Mar 21 17:17:40 2014 -0400
----------------------------------------------------------------------
storm-core/src/jvm/backtype/storm/utils/Time.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/28e65a82/storm-core/src/jvm/backtype/storm/utils/Time.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/utils/Time.java b/storm-core/src/jvm/backtype/storm/utils/Time.java
index 506b074..50a79fd 100644
--- a/storm-core/src/jvm/backtype/storm/utils/Time.java
+++ b/storm-core/src/jvm/backtype/storm/utils/Time.java
@@ -36,14 +36,18 @@ public class Time {
private static AtomicLong simulatedCurrTimeMs; //should this be a thread local that's allowed to keep advancing?
public static void startSimulating() {
- simulating.set(true);
- simulatedCurrTimeMs = new AtomicLong(0);
- threadSleepTimes = new ConcurrentHashMap<Thread, AtomicLong>();
+ synchronized(sleepTimesLock) {
+ simulating.set(true);
+ simulatedCurrTimeMs = new AtomicLong(0);
+ threadSleepTimes = new ConcurrentHashMap<Thread, AtomicLong>();
+ }
}
public static void stopSimulating() {
- simulating.set(false);
- threadSleepTimes = null;
+ synchronized(sleepTimesLock) {
+ simulating.set(false);
+ threadSleepTimes = null;
+ }
}
public static boolean isSimulating() {
@@ -61,7 +65,9 @@ public class Time {
}
} finally {
synchronized(sleepTimesLock) {
- threadSleepTimes.remove(Thread.currentThread());
+ if (simulating.get()) {
+ threadSleepTimes.remove(Thread.currentThread());
+ }
}
}
} else {
[2/3] git commit: Merge branch 'patch-1' of
github.com:apetresc/incubator-storm
Posted by pt...@apache.org.
Merge branch 'patch-1' of github.com:apetresc/incubator-storm
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/23f66706
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/23f66706
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/23f66706
Branch: refs/heads/master
Commit: 23f667067c65488a5df4d83ac0b10d9cd3066325
Parents: eb3ecb3 28e65a8
Author: P. Taylor Goetz <pt...@gmail.com>
Authored: Wed Apr 9 14:04:43 2014 -0400
Committer: P. Taylor Goetz <pt...@gmail.com>
Committed: Wed Apr 9 14:04:43 2014 -0400
----------------------------------------------------------------------
storm-core/src/jvm/backtype/storm/utils/Time.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
[3/3] git commit: update CHANGELOG
Posted by pt...@apache.org.
update CHANGELOG
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/89e2fbbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/89e2fbbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/89e2fbbd
Branch: refs/heads/master
Commit: 89e2fbbdb187e7f8bdbd75a5710aa3c61ceb4632
Parents: 23f6670
Author: P. Taylor Goetz <pt...@gmail.com>
Authored: Wed Apr 9 14:15:17 2014 -0400
Committer: P. Taylor Goetz <pt...@gmail.com>
Committed: Wed Apr 9 14:15:17 2014 -0400
----------------------------------------------------------------------
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/89e2fbbd/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cd7e75..a7131e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
## 0.9.2-incubating (unreleased)
+ * Fix a potential race condition with simulated time in Storm's unit tests
* STORM-258: Update commons-io version to 2.4
* STORM-270: don't package .clj files in release jars.
* STORM-273: Error while running storm topologies on Windows using "storm jar"