Skip to content

Commit 0a5694a

Browse files
[GR-71175] Improve error messages.
PullRequest: graal/22533
2 parents a9551ed + 4fcb3ec commit 0a5694a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/AddressRangeCommittedMemoryProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public class AddressRangeCommittedMemoryProvider extends ChunkBasedCommittedMemo
111111
protected static final int OUT_OF_ADDRESS_SPACE = 1;
112112
protected static final int COMMIT_FAILED = 2;
113113

114+
protected static final String UNCOMMIT_FAILED_ERROR_MSG = "Failed while uncommitting memory. " +
115+
"This error may occur if the operating system's memory mapping limit is too low (see vm.max_map_count on Linux). Please increase this limit and try again.";
114116
private static final OutOfMemoryError NODE_ALLOCATION_FAILED = new OutOfMemoryError("Could not allocate node for free list, OS may be out of memory.");
115117
private static final OutOfMemoryError OUT_OF_METASPACE = new OutOfMemoryError("Could not allocate a metaspace chunk because the metaspace is exhausted.");
116118
private static final OutOfMemoryError ALIGNED_OUT_OF_ADDRESS_SPACE = new OutOfMemoryError("Could not allocate an aligned heap chunk because the heap address space is exhausted. " +
@@ -776,7 +778,7 @@ private static RuntimeException reportUncommitFailed(Pointer mapBegin, UnsignedW
776778

777779
private static RuntimeException reportUncommitFailedInterruptibly(Pointer mapBegin, UnsignedWord mappingSize) {
778780
Log.log().string("Uncommitting ").unsigned(mappingSize).string(" bytes of unused memory at ").hex(mapBegin).string(" failed.").newline();
779-
throw VMError.shouldNotReachHere("Uncommitting memory failed.");
781+
throw VMError.shouldNotReachHere(UNCOMMIT_FAILED_ERROR_MSG);
780782
}
781783

782784
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/code/RuntimeCodeInfoAccess.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,9 @@ public static void makeCodeMemoryExecutableWritable(CodePointer start, UnsignedW
238238
private static void protectCodeMemory(CodePointer codeStart, UnsignedWord codeSize, int permissions) {
239239
int result = VirtualMemoryProvider.get().protect(codeStart, codeSize, permissions);
240240
if (result != 0) {
241-
throw VMError.shouldNotReachHere("Failed to modify protection of code memory. This may be caused by " +
242-
"a. a too restrictive OS-limit of allowed memory mappings (see vm.max_map_count on Linux), " +
243-
"b. a too strict security policy if you are running on Security-Enhanced Linux (SELinux), or " +
244-
"c. a Native Image internal error.");
241+
throw VMError.shouldNotReachHere("Failed to modify protection of code memory. " +
242+
"This error may occur if the operating system's memory mapping limit is too low (see vm.max_map_count on Linux). Please increase this limit and try again." +
243+
"If you are running on Security-Enhanced Linux (SELinux), you may also need to check the configured security policy.");
245244
}
246245
}
247246

0 commit comments

Comments
 (0)