diff options
| author | 2016-10-26 08:59:38 +0000 | |
|---|---|---|
| committer | 2016-10-26 08:59:38 +0000 | |
| commit | 1da4508b9a1225966ffc369529f8672f9e5d587f (patch) | |
| tree | 821d37ff21f43a54f066bc1877db6a6203f0471b | |
| parent | d1d24926aca468c1f6053cc020b8b95412ec157b (diff) | |
| parent | a5c61bf479453e7e195888afb4e62a9872d6be7c (diff) | |
Merge "Fall back to true anonymous mmap if out of file descriptors."
| -rw-r--r-- | runtime/mem_map.cc | 13 | ||||
| -rw-r--r-- | test/151-OpenFileLimit/expected.txt | 2 | ||||
| -rw-r--r-- | test/151-OpenFileLimit/info.txt | 5 | ||||
| -rw-r--r-- | test/151-OpenFileLimit/src/Main.java | 6 | ||||
| -rw-r--r-- | test/Android.run-test.mk | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc index 422da41053..1ec59b3cc7 100644 --- a/runtime/mem_map.cc +++ b/runtime/mem_map.cc @@ -318,11 +318,18 @@ MemMap* MemMap::MapAnonymous(const char* name, debug_friendly_name += name; fd.Reset(ashmem_create_region(debug_friendly_name.c_str(), page_aligned_byte_count), /* check_usage */ false); + if (fd.Fd() == -1) { - *error_msg = StringPrintf("ashmem_create_region failed for '%s': %s", name, strerror(errno)); - return nullptr; + // We failed to create the ashmem region. Print a warning, but continue + // anyway by creating a true anonymous mmap with an fd of -1. It is + // better to use an unlabelled anonymous map than to fail to create a + // map at all. + PLOG(WARNING) << "ashmem_create_region failed for '" << name << "'"; + } else { + // We succeeded in creating the ashmem region. Use the created ashmem + // region as backing for the mmap. + flags &= ~MAP_ANONYMOUS; } - flags &= ~MAP_ANONYMOUS; } // We need to store and potentially set an error number for pretty printing of errors diff --git a/test/151-OpenFileLimit/expected.txt b/test/151-OpenFileLimit/expected.txt index 971e472bff..6bc45ef24d 100644 --- a/test/151-OpenFileLimit/expected.txt +++ b/test/151-OpenFileLimit/expected.txt @@ -1,3 +1,3 @@ Message includes "Too many open files" -Message includes "Too many open files" +thread run. done. diff --git a/test/151-OpenFileLimit/info.txt b/test/151-OpenFileLimit/info.txt index 56ed3963f4..9af393d78b 100644 --- a/test/151-OpenFileLimit/info.txt +++ b/test/151-OpenFileLimit/info.txt @@ -1,3 +1,2 @@ -This test verifies the exception message is informative for failure to launch -a thread due to the number of available file descriptors in the process being -exceeded. +This test verifies that running out of file descriptors in the process doesn't +prevent us from launching a new thread. diff --git a/test/151-OpenFileLimit/src/Main.java b/test/151-OpenFileLimit/src/Main.java index 01a9a4ed34..9fe47c8b16 100644 --- a/test/151-OpenFileLimit/src/Main.java +++ b/test/151-OpenFileLimit/src/Main.java @@ -52,11 +52,7 @@ public class Main { thread.start(); thread.join(); } catch (Throwable e) { - if (e.getMessage().contains("Too many open files")) { - System.out.println("Message includes \"Too many open files\""); - } else { - System.out.println(e.getMessage()); - } + System.out.println(e.getMessage()); } for (int i = 0; i < files.size(); i++) { diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 9b456c1e4c..1e3a997c7a 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -232,11 +232,9 @@ ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), # Disable 149-suspend-all-stress, its output is flaky (b/28988206). -# Disable 151-OpenFileLimit (b/32302133) # Disable 577-profile-foreign-dex (b/27454772). TEST_ART_BROKEN_ALL_TARGET_TESTS := \ 149-suspend-all-stress \ - 151-OpenFileLimit \ 577-profile-foreign-dex \ ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ |