You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Steffen Pingel (JIRA)" <ji...@apache.org> on 2007/05/09 01:56:15 UTC

[jira] Created: (HTTPCORE-72) HttpConnectionParams.getSocketBufferSize() returns -1 by default

HttpConnectionParams.getSocketBufferSize() returns -1 by default
----------------------------------------------------------------

                 Key: HTTPCORE-72
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-72
             Project: HttpComponents Core
          Issue Type: Improvement
          Components: HttpCore NIO
    Affects Versions: 4.0-alpha5
            Reporter: Steffen Pingel


I was using an object of type BasicHttpParams which had no properties set and got an exception in the constructor of ExpandableBuffer when I tried to create a DefaultNHttpServerConnection. It is somewhat difficult for a caller to tell from the trace was the cause of the error actually is:

java.lang.IllegalArgumentException
	at java.nio.Buffer.<init>(Buffer.java:174)
	at java.nio.ByteBuffer.<init>(ByteBuffer.java:259)
	at java.nio.ByteBuffer.<init>(ByteBuffer.java:267)
	at java.nio.MappedByteBuffer.<init>(MappedByteBuffer.java:64)
	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:94)
	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
	at org.apache.http.nio.util.ExpandableBuffer.<init>(ExpandableBuffer.java:46)
	at org.apache.http.impl.nio.reactor.SessionInputBuffer.<init>(SessionInputBuffer.java:55)
	at org.apache.http.impl.nio.NHttpConnectionBase.<init>(NHttpConnectionBase.java:111)
	at org.apache.http.impl.nio.DefaultNHttpServerConnection.<init>(DefaultNHttpServerConnection.java:63)
[...]


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-72) HttpConnectionParams.getSocketBufferSize() returns -1 by default

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494675 ] 

Oleg Kalnichevski commented on HTTPCORE-72:
-------------------------------------------

Hi Steffen

The trouble here is that it is difficult to say what the default value should be, as it may not suit all types of HTTP service handlers. In some cases where the size of the content buffer stays constant, it makes sense to have a largish value. For expandable buffers it would probably make make more sense to keep the initial size relatively small. I think this is more of a problem with the silly practice on the part of SUN developers to throw generic exceptions without an accompanying message that describes the nature of the problem.

What the default value should be?

Oleg

> HttpConnectionParams.getSocketBufferSize() returns -1 by default
> ----------------------------------------------------------------
>
>                 Key: HTTPCORE-72
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-72
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha5
>            Reporter: Steffen Pingel
>
> I was using an object of type BasicHttpParams which had no properties set and got an exception in the constructor of ExpandableBuffer when I tried to create a DefaultNHttpServerConnection. It is somewhat difficult for a caller to tell from the trace was the cause of the error actually is:
> java.lang.IllegalArgumentException
> 	at java.nio.Buffer.<init>(Buffer.java:174)
> 	at java.nio.ByteBuffer.<init>(ByteBuffer.java:259)
> 	at java.nio.ByteBuffer.<init>(ByteBuffer.java:267)
> 	at java.nio.MappedByteBuffer.<init>(MappedByteBuffer.java:64)
> 	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:94)
> 	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
> 	at org.apache.http.nio.util.ExpandableBuffer.<init>(ExpandableBuffer.java:46)
> 	at org.apache.http.impl.nio.reactor.SessionInputBuffer.<init>(SessionInputBuffer.java:55)
> 	at org.apache.http.impl.nio.NHttpConnectionBase.<init>(NHttpConnectionBase.java:111)
> 	at org.apache.http.impl.nio.DefaultNHttpServerConnection.<init>(DefaultNHttpServerConnection.java:63)
> [...]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Resolved: (HTTPCORE-72) HttpConnectionParams.getSocketBufferSize() returns -1 by default

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-72?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-72.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.0-alpha5

Changed HttpConnectionParams#getSocketBufferSize() to return 1024 by default

Oleg

> HttpConnectionParams.getSocketBufferSize() returns -1 by default
> ----------------------------------------------------------------
>
>                 Key: HTTPCORE-72
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-72
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha5
>            Reporter: Steffen Pingel
>             Fix For: 4.0-alpha5
>
>
> I was using an object of type BasicHttpParams which had no properties set and got an exception in the constructor of ExpandableBuffer when I tried to create a DefaultNHttpServerConnection. It is somewhat difficult for a caller to tell from the trace was the cause of the error actually is:
> java.lang.IllegalArgumentException
> 	at java.nio.Buffer.<init>(Buffer.java:174)
> 	at java.nio.ByteBuffer.<init>(ByteBuffer.java:259)
> 	at java.nio.ByteBuffer.<init>(ByteBuffer.java:267)
> 	at java.nio.MappedByteBuffer.<init>(MappedByteBuffer.java:64)
> 	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:94)
> 	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
> 	at org.apache.http.nio.util.ExpandableBuffer.<init>(ExpandableBuffer.java:46)
> 	at org.apache.http.impl.nio.reactor.SessionInputBuffer.<init>(SessionInputBuffer.java:55)
> 	at org.apache.http.impl.nio.NHttpConnectionBase.<init>(NHttpConnectionBase.java:111)
> 	at org.apache.http.impl.nio.DefaultNHttpServerConnection.<init>(DefaultNHttpServerConnection.java:63)
> [...]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-72) HttpConnectionParams.getSocketBufferSize() returns -1 by default

Posted by "Steffen Pingel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495669 ] 

Steffen Pingel commented on HTTPCORE-72:
----------------------------------------

I agree that it should be a small value such as 512 that fits a typical HTTP request and keeps the per connection overhead low by default. As an alternative the constructor of NHttpConnectionBase could the value of buffersize and throw a meaningful exception.

> HttpConnectionParams.getSocketBufferSize() returns -1 by default
> ----------------------------------------------------------------
>
>                 Key: HTTPCORE-72
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-72
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha5
>            Reporter: Steffen Pingel
>
> I was using an object of type BasicHttpParams which had no properties set and got an exception in the constructor of ExpandableBuffer when I tried to create a DefaultNHttpServerConnection. It is somewhat difficult for a caller to tell from the trace was the cause of the error actually is:
> java.lang.IllegalArgumentException
> 	at java.nio.Buffer.<init>(Buffer.java:174)
> 	at java.nio.ByteBuffer.<init>(ByteBuffer.java:259)
> 	at java.nio.ByteBuffer.<init>(ByteBuffer.java:267)
> 	at java.nio.MappedByteBuffer.<init>(MappedByteBuffer.java:64)
> 	at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:94)
> 	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
> 	at org.apache.http.nio.util.ExpandableBuffer.<init>(ExpandableBuffer.java:46)
> 	at org.apache.http.impl.nio.reactor.SessionInputBuffer.<init>(SessionInputBuffer.java:55)
> 	at org.apache.http.impl.nio.NHttpConnectionBase.<init>(NHttpConnectionBase.java:111)
> 	at org.apache.http.impl.nio.DefaultNHttpServerConnection.<init>(DefaultNHttpServerConnection.java:63)
> [...]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org