diff options
author | 2016-06-21 10:38:23 +0100 | |
---|---|---|
committer | 2016-06-21 10:54:05 +0100 | |
commit | 5fe1026cca5df935bd55ab1ee6892eeae02819c4 (patch) | |
tree | 8bf44b5aeb1e353643f255ec3e504e18ddb815c7 | |
parent | 453134813e9ba2b91622550d76ddff44a1ab48ab (diff) |
Catch additional OOME in ThreadStress.
And use pthread_sigmask() instead of sigprocmask() because
the latter is unspecified in a multithreaded process.
Bug: 27371304
Change-Id: Ia511ff62d38c0fcd985421442e506cdc5f8f30bf
-rw-r--r-- | runtime/signal_set.h | 4 | ||||
-rw-r--r-- | test/004-ThreadStress/src/Main.java | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/runtime/signal_set.h b/runtime/signal_set.h index c272514f61..6f888525cb 100644 --- a/runtime/signal_set.h +++ b/runtime/signal_set.h @@ -38,8 +38,8 @@ class SignalSet { } void Block() { - if (sigprocmask(SIG_BLOCK, &set_, nullptr) == -1) { - PLOG(FATAL) << "sigprocmask failed"; + if (pthread_sigmask(SIG_BLOCK, &set_, nullptr) != 0) { + PLOG(FATAL) << "pthread_sigmask failed"; } } diff --git a/test/004-ThreadStress/src/Main.java b/test/004-ThreadStress/src/Main.java index b9a46deba8..acd8e8b344 100644 --- a/test/004-ThreadStress/src/Main.java +++ b/test/004-ThreadStress/src/Main.java @@ -107,6 +107,7 @@ public class Main implements Runnable { public boolean perform() { try { kill.invoke(null, pid, sigquit); + } catch (OutOfMemoryError e) { } catch (Exception e) { if (!e.getClass().getName().equals("ErrnoException")) { e.printStackTrace(System.out); @@ -154,7 +155,10 @@ public class Main implements Runnable { private final static class StackTrace extends Operation { @Override public boolean perform() { - Thread.currentThread().getStackTrace(); + try { + Thread.currentThread().getStackTrace(); + } catch (OutOfMemoryError e) { + } return true; } } |