On Tue, 2018-02-13 at 15:06 -0700, Gary Gregory wrote: > Something for the release notes? >
Of course. Is there any need to cut 4.4.10 now? Oleg > Gary > > On Tue, Feb 13, 2018 at 11:29 AM, <ol...@apache.org> wrote: > > > Repository: httpcomponents-core > > Updated Branches: > > refs/heads/4.4.x 7bfffc547 -> 11909bdcc > > > > > > ExpandableBuffer breaks on large response > > > > Ticket: https://issues.apache.org/jira/browse/HTTPCORE-513 > > This closes #58 > > > > > > Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core > > /repo > > Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/ > > commit/11909bdc > > Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/ > > tree/11909bdc > > Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/ > > diff/11909bdc > > > > Branch: refs/heads/4.4.x > > Commit: 11909bdcc33fbc29037338d870dd2f8a4e507ec7 > > Parents: 7bfffc5 > > Author: imoldovan-intacct <imoldo...@intacct.com> > > Authored: Mon Feb 12 17:02:06 2018 +0200 > > Committer: Oleg Kalnichevski <ol...@apache.org> > > Committed: Tue Feb 13 19:27:40 2018 +0100 > > > > ----------------------------------------------------------------- > > ----- > > .../org/apache/http/nio/util/ExpandableBuffer.java | 14 > > +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > ----------------------------------------------------------------- > > ----- > > > > > > http://git-wip-us.apache.org/repos/asf/httpcomponents-core/ > > blob/11909bdc/httpcore-nio/src/main/java/org/apache/http/ > > nio/util/ExpandableBuffer.java > > ----------------------------------------------------------------- > > ----- > > diff --git a/httpcore- > > nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java > > b/httpcore-nio/src/main/java/org/apache/http/nio/util/ > > ExpandableBuffer.java > > index 7e06da4..74b5765 100644 > > --- a/httpcore-nio/src/main/java/org/apache/http/nio/util/ > > ExpandableBuffer.java > > +++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/ > > ExpandableBuffer.java > > @@ -116,7 +116,19 @@ public class ExpandableBuffer implements > > BufferInfo, > > org.apache.http.nio.util.Bu > > protected void expand() { > > int newcapacity = (this.buffer.capacity() + 1) << 1; > > if (newcapacity < 0) { > > - newcapacity = Integer.MAX_VALUE; > > + final int vmBytes = Long.SIZE >> 3; > > + final int javaBytes = 8; // this is to be checked when > > the > > JVM version changes > > + @SuppressWarnings("unused") // we really need the 8 if > > we're > > going to make this foolproof > > + final int headRoom = (vmBytes >= javaBytes) ? vmBytes > > : > > javaBytes; > > + // Reason: In GC the size of objects is passed as int > > (2 > > bytes). > > + // Then, the header size of the objects is added to > > the size. > > + // Long has the longest header available. Object > > header seems > > to be linked to it. > > + // Details: I added a minimum of 8 just to be safe and > > because 8 is used in > > + // java.lang.Object.ArrayList: private static final > > int > > MAX_ARRAY_SIZE = 2147483639. > > + // > > + // WARNING: This code assumes you are providing enough > > heap > > room with -Xmx. > > + // source of inspiration: https://bugs.openjdk.java.ne > > t/ > > browse/JDK-8059914 > > + newcapacity = Integer.MAX_VALUE - headRoom; > > } > > expandCapacity(newcapacity); > > } > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org