dzieciou / curl-logger

Logs HTTP requests sent by REST-assured as CURL commands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting Invalid use of BasicClientConnManager: in parallel environment

kushalpal17 opened this issue · comments

mvn gauge:execute -DspecsDir="specs/" -DinParallel=true -Dnodes=4


java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.

Thanks for reporting the problem.

  1. Does the problem occur if you don't use curl logger? If so, it might be related to how RestAssured uses Apache HTTP Client.
  2. If no, can you provide me minimal working example so I can reproduce the case? Especially what's your Maven configuration (pom.xml) and what's inside of specs/?

I happened to get this same error too and I think it happened when I had two sequential calls for RestAssured, one with a post and the other with a delete but still using the same request specification object.

If I get this error again I'll try and come back here to update this comment with a sample.

I was able to reproduce the bug following instructions from @francislainy . This seems to be a bug in REST-assured that I reported there: rest-assured/rest-assured#1392. REST-assured is not releasing HTTP connections when reusing HTTP client instance.

A workaround would be to remove reuseHttpClientInstance() in CurlRestAssuredConfigFactory, but I would prefer this to be fixed in REST-assured. There are reasons to reuse HTTP client instance across multiple requests, namely, performance reasons. You don't want to introduce additional overhead.

I decided to not reuse HTTP client. Hope this will fix the issue.