You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Gary Gregory <ga...@gmail.com> on 2018/02/13 22:06:19 UTC
Re: httpcomponents-core git commit: ExpandableBuffer breaks on large response
Something for the release notes?
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 <im...@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.net/
> browse/JDK-8059914
> + newcapacity = Integer.MAX_VALUE - headRoom;
> }
> expandCapacity(newcapacity);
> }
>
>
Re: httpcomponents-core git commit: ExpandableBuffer breaks on large response
Posted by Gary Gregory <ga...@gmail.com>.
On Feb 14, 2018 03:51, "Oleg Kalnichevski" <ol...@apache.org> wrote:
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?
Not for me but I think it makes sense to keep the RNs in sync with the code
as we go.
Gary
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 <im...@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-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: httpcomponents-core git commit: ExpandableBuffer breaks on
large response
Posted by Oleg Kalnichevski <ol...@apache.org>.
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 <im...@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-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org