REST API: Connection closed by peer

View: New views
5 Messages — Rating Filter:   Alert me  

REST API: Connection closed by peer

by Alessandro Vernet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What follows makes me believe there is a limit the length of queries sent to eXist through the REST API with a GET.

I am sending a query such as:

http://localhost:8080/exist/rest/db?_query=42(:large comment:)

This returns 42, as it should, unless the comment is "too large", in which case eXist closes the connection right after it receives the query. What goes over HTTP (shown with the great tool HTTP Scoop), convinced me that it is really eXist that closes the connection and not the HTTP client that somehow gives up along the way. Does anyone have any clue as to why this would be happening?

I am using code in the 1.2.2 branch from a couple of weeks ago.

Alex
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet

Re: RE ST API: Connection closed by peer

by Dannes Wessels-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

On Jul 14, 2008, at 19:33 , Alessandro Vernet wrote:
> What follows makes me believe there is a limit the length of queries  
> sent to eXist through the REST API with a GET.
>
> http://localhost:8080/exist/rest/db?_query=42(:large comment:)

Hmmmm, can you provide an approximate maximum on the size of the large  
comment? Is it about 'just a few characters' or are you talking about  
a mega byte large string?

regards

Dannes

---
eXist-db Open Source Native XML Database
http://exist-db.org



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

smime.p7s (2K) Download Attachment

Re: RE ST API: Connection closed by peer

by ToddG :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I googled "HTTP GET QUERYSTRING MAXIMUM LENGTH" and found this info taken from http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html
 
RFC 2068 states:
    Servers should be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations may not properly support these lengths.
The spec for URL length does not dictate a minimum or maximum URL length, but implementation varies by browser. On Windows: Opera supports ~4050 characters, IE 4.0+ supports exactly 2083 characters, Netscape 3 -> 4.78 support up to 8192 characters before causing errors on shut-down, and Netscape 6 supports ~2000 before causing errors on start-up. 
 
Note that there is no limit on the number of parameters you can stuff into a URL, but only on the length it can aggregate to. 

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: RE ST API: Connection closed by peer

by Dannes Wessels-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 14, 2008, at 19:42 , Dannes Wessels wrote:

> Hmmmm, can you provide an approximate maximum on the size of the  
> large comment? Is it about 'just a few characters' or are you  
> talking about a mega byte large string?

Although I chatted with you by skype, cc-ing the ML...

The specs (http://www.faqs.org/rfcs/rfc2068.html) write about a limit..
The HTTP protocol does not place any a priori limit on the length of
a URI. Servers MUST be able to handle the URI of any resource they
serve, and SHOULD be able to handle URIs of unbounded length if they
provide GET-based forms that could generate such URIs. A server
SHOULD return 414 (Request-URI Too Long) status if a URI is longer
than the server can handle (see section 10.4.15).

Note: Servers should be cautious about depending on URI lengths
above 255 bytes, because some older client or proxy implementations
may not properly support these lengths.

I read that MSIE is quite limiting in here (not relevant for you  
though). Probably you hit a limitation of the webcontainer, tomcat in  
your case. Does the HTTP request actually read the exist-code or is it  
already blocked...
(continued)
jups, jetty blocks it neatly:
14 Jul 2008 20:06:09,679 [P1-9] WARN  (HttpConnection.java [exception]:
768) - null null null HttpException(414,Request URI Too Large,null)

probably tomcat has some special behaviour here. I remember that we  
had some changes recently for sendinq queries TO exist using POST.......
regards
Dannes

eXist-db Open Source Native XML Database
http://exist-db.org








-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

smime.p7s (2K) Download Attachment

Re: REST API: Connection closed by peer

by Alessandro Vernet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alessandro Vernet wrote:
What follows makes me believe there is a limit the length of queries sent to eXist through the REST API with a GET. [...]
With the help from Dannes (thank you!), we figured out that this is not an issue with eXist, but with Tomcat. It is Tomcat that closes the connection when it considers the URL to be too long. (It should instead respond with a 414, like Jetty does.)

Increasing the value of maxHttpHeaderSize on the Connector element in server.xml solves the problem. I had it set to 8192 (8K), and the URL I had in this case was just above 9K. You might wonder why an attribute called maxHttpHeaderSize, with a documentation that matches its name (http://tomcat.apache.org/tomcat-5.5-doc/config/http.html), applies to URL length. I wonder too, but I guess this is a topic for another mailing list :).

Alex
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
LightInTheBox - Buy quality products at wholesale price