sahaya / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

RestAssured hangs default Restlet connector #168

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Extract attached zip.
2. Execute mvn clean install.

What is the expected output? What do you see instead?
All tests should pass but instead see the errors below from Restlet that 
indicate all of its worker threads are consumed and the test hangs.  Note that 
the tests are single threaded.

May 1, 2012 3:06:22 PM org.restlet.engine.http.connector.BaseHelper$1 
rejectedExecution
WARNING: Unable to run the following server-side task: Read connection 
messages: true
May 1, 2012 3:06:22 PM org.restlet.engine.http.connector.BaseHelper$1 
rejectedExecution
INFO: Worker service state: Normal
May 1, 2012 3:06:22 PM org.restlet.engine.http.connector.BaseHelper$1 
rejectedExecution
INFO: Worker service tasks: 0 queued, 9 active, 10 completed, 19 scheduled.
May 1, 2012 3:06:22 PM org.restlet.engine.http.connector.BaseHelper$1 
rejectedExecution
INFO: Worker service thread pool: 1 core size, 10 largest size, 10 maximum 
size, 10 current size
May 1, 2012 3:06:22 PM org.restlet.engine.http.connector.Controller run
INFO: Stop accepting new connections and transactions. Consider increasing the 
maximum number of threads.

What version of the product are you using? On what operating system?
RestAssured: 1.6.2-SNAPSHOT
Restlet: 2.0.13
Jetty: 6.1.26
MacOS: 10.7.3
Java: 1.6.0_31

Please provide any additional information below.
The attached tests include multiple clients running against multiple servers.
HttpClient -> Jetty (OK)
HttpClient -> Restlet (OK)
RestAssured -> Jetty (OK)
RestAssured -> Restlet (HANG)

The meat of the tests are in test.HangTestBase which is extended in 
HangJettyTest and HangRestletTest.  Note I also tried a version of the test 
(testForHangWithRestAssuredGetManualClose) where I tried to manually close the 
response body stream and that fails too. 

Original issue reported on code.google.com by kmin...@gmail.com on 1 May 2012 at 7:18

Attachments:

GoogleCodeExporter commented 9 years ago
Hi, 

Thanks for your example project and good description of the project. I've fixed 
the problem in trunk now for all your examples. Please try it out. I've 
deployed version 1.6.2-SNAPSHOT to sonatype so add:

<repositories>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots />
        </repository>
</repositories>

to try it out.

Original comment by johan.ha...@gmail.com on 2 May 2012 at 12:11

GoogleCodeExporter commented 9 years ago
Hi,
Works for me too!  Thanks again!  Would you mind briefly describing what
the issue was so that I don't make the same mistake somewhere down the
line.
Kevin.

On 5/2/12 8:11 AM, "rest-assured@googlecode.com"
<rest-assured@googlecode.com> wrote:

Original comment by kmin...@gmail.com on 2 May 2012 at 1:32

GoogleCodeExporter commented 9 years ago
REST Assured didn't close the idling connections and Restlet was configured to 
accept at most 10 connections at the same time and thus blocked subsequent 
requests. So I had to close the idling connections in REST Assured just as you 
did when using plain http client. Another problem was when getting the response 
body as an inputstream because then the connection cannot be closed until the 
user calls close on the inputstream. Thus I had to wrap the inputstream from 
the http client in my own inputstream that closed the connection when closing 
the inputstream.

Original comment by johan.ha...@gmail.com on 2 May 2012 at 1:53