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
diff --git a/runtime/signal_set.h b/runtime/signal_set.h
index c272514..6f88852 100644
--- a/runtime/signal_set.h
+++ b/runtime/signal_set.h
@@ -38,8 +38,8 @@
}
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 b9a46de..acd8e8b 100644
--- a/test/004-ThreadStress/src/Main.java
+++ b/test/004-ThreadStress/src/Main.java
@@ -107,6 +107,7 @@
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 @@
private final static class StackTrace extends Operation {
@Override
public boolean perform() {
- Thread.currentThread().getStackTrace();
+ try {
+ Thread.currentThread().getStackTrace();
+ } catch (OutOfMemoryError e) {
+ }
return true;
}
}