Re: Final call Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-10 Thread Stuart Marks
Regarding the wording, I don't think either "implementation limit" or "VM limit" is correct, at least not in all the cases. If we were using ArraysSupport.newLength, the error messages are as follows: 1) Actual shortage of heap space. Hotspot generates this: OutOfMemoryError: Java

Re: Final call Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-10 Thread Roger Riggs
Hi Jim, In Unsafe.java: 632: the "Unable to allocate 98494837395: doesn't read very well. Please add " bytes" to the end. I would probably drop "array" from all the messages but at least in the String* cases. As Martin notes, the array is an implementation detail. (And i still prefer

Re: Final call Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-10 Thread Jim Laskey
Thank you. > On Jun 10, 2020, at 2:10 PM, Martin Buchholz wrote: > > On Wed, Jun 10, 2020 at 9:35 AM Jim Laskey wrote: > >>> --- >>> It looks like >>> newCap > oldCap >>> is always true, so we should delete the test? >>>if (newCap > oldCap && queue == array) >>> --- >> >> If

Re: Final call Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-10 Thread Martin Buchholz
On Wed, Jun 10, 2020 at 9:35 AM Jim Laskey wrote: > > --- > > It looks like > > newCap > oldCap > > is always true, so we should delete the test? > > if (newCap > oldCap && queue == array) > > --- > > If oldCap == MAX_ARRAY_SIZE wouldn't newCap == oldCap newLength's contract is

Re: Final call Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-10 Thread Jim Laskey
> On Jun 10, 2020, at 1:15 PM, Martin Buchholz wrote: > > I took a look at PriorityBlockingQueue. > > Part of converting to ArraysSupport involves deleting the local orphan > MAX_ARRAY_SIZE; that needs to be done. Removed. > > --- > It looks like > newCap > oldCap > is always true, so we

Re: Final call Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-10 Thread Martin Buchholz
I took a look at PriorityBlockingQueue. Part of converting to ArraysSupport involves deleting the local orphan MAX_ARRAY_SIZE; that needs to be done. --- It looks like newCap > oldCap is always true, so we should delete the test? if (newCap > oldCap && queue == array) --- In

Final call Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-10 Thread Jim Laskey
Will push if no comments by EOB. > On Jun 8, 2020, at 2:22 PM, Jim Laskey wrote: > > Revised to use a consistent error message. Modified AbstractStringBuilder and > PriorityBlockingQueue to use ArraysSupport.newLength(). Didn't modify > ByteArrayChannel and UnsyncByteArrayOutputStream since

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-08 Thread Jim Laskey
Revised to use a consistent error message. Modified AbstractStringBuilder and PriorityBlockingQueue to use ArraysSupport.newLength(). Didn't modify ByteArrayChannel and UnsyncByteArrayOutputStream since those changes would require changes to module exporting. webrev:

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-03 Thread Jim Laskey
It's not the goal or role of this bug to fix the wrongs of the past, merely add error messages to the exceptions. I raised the discussion as an issue. Clearly there is a correct path to follow. If you think more effort is required then file a bug. :-) Cheers, -- Jim > On Jun 2, 2020, at

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-02 Thread Stuart Marks
On 6/2/20 6:52 AM, Jim Laskey wrote: Revised to reflect requested changes. http://cr.openjdk.java.net/~jlaskey/8230744/webrev-01/index.html On this, if all you're doing is changing exception messages, then I don't care

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-02 Thread Roger Riggs
Hi Jim, Given the infrequency of the exception messages being used, can we simplify them and/or reuse the strings? The stack trace would usually show what API was being used so I would simplfy the messages to: "exceeds implementation limit" or "size exceeds implementation limit".   

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-02 Thread Jim Laskey
Revised to reflect requested changes. http://cr.openjdk.java.net/~jlaskey/8230744/webrev-01/index.html > On Jun 1, 2020, at 5:40 PM, Martin Buchholz wrote: > > On Mon, Jun 1, 2020 at 1:37 PM Brent Christian > wrote: > >>

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-01 Thread Martin Buchholz
On Mon, Jun 1, 2020 at 1:37 PM Brent Christian wrote: > "Unable to allocate buffer" seems vague in the context of an OOME. If > the problem is trying to create a too-large array, maybe something like, > "Buffer for \\Q...\\E sequence would exceed maximum array size". A generic message that

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-01 Thread Martin Buchholz
I continue to think JDK library code should avoid exposing VM implementation limits to users, i.e. exception detail messages should not include MAX_ARRAY_SIZE I think our grow code has been drifting to being inconsistent and incoherent over the years. In the code below, the detail message looks

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-01 Thread Brent Christian
One comment: src/java.base/share/classes/java/util/regex/Pattern.java --- 1679,1690 i += 2; int newTempLen; try { newTempLen = Math.addExact(j + 2, Math.multiplyExact(3, pLen - i)); } catch (ArithmeticException ae) { !

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-01 Thread Jim Laskey
To be honest I should (will) file another bug against the use of math exact here. I don't think the tests actually catch what they think they test. Looks good in theory but more often than not, the pos array above that code will blow up before you get there. > On Jun 1, 2020, at 4:09 PM,

Re: RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-01 Thread Paul Sandoz
+1 I quibble about the “ignored” variable name for the caught ArithmeticException. Paul. > On Jun 1, 2020, at 5:48 AM, Jim Laskey wrote: > > Cleans up every case of OutOfMemoryError without a message. Some logic > changes in String::repeat and ByteArrayChannel:: hugeCapacity. > > Thank you.

RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

2020-06-01 Thread Jim Laskey
Cleans up every case of OutOfMemoryError without a message. Some logic changes in String::repeat and ByteArrayChannel:: hugeCapacity. Thank you. Cheers, -- Jim webrev: http://cr.openjdk.java.net/~jlaskey/8230744/webrev-00/index.html