[jboss-remoting-issues] [JBoss JIRA] Created: (JBREM-1248) Avoid connecting to a server in catch clause in case of HttpClientInvoker connection failure

Toshiya Kobayashi (JIRA) jira-events at lists.jboss.org
Wed Sep 29 01:06:28 EDT 2010


Avoid connecting to a server in catch clause in case of HttpClientInvoker connection failure
--------------------------------------------------------------------------------------------

                 Key: JBREM-1248
                 URL: https://jira.jboss.org/browse/JBREM-1248
             Project: JBoss Remoting
          Issue Type: Feature Request
      Security Level: Public (Everyone can see)
          Components: transport
    Affects Versions: 2.5.3.SP1, 2.2.3.SP2
            Reporter: Toshiya Kobayashi


Due to a change introduced by JBREM-960 , HttpClientInvoker will try to connect to a server again by HttpURLConnection#getResponseMessage() in catch clause.

      try
      {
...
            OutputStream stream = conn.getOutputStream();
...
      {
      catch (Exception e)
      {
         String message = "Can not connect http client invoker.";
         if (e.getMessage() != null)
            message += " " + e.getMessage() + ".";

         try
         {
            String responseMessage = conn.getResponseMessage();
            int code = conn.getResponseCode();
            message += " Response: " + responseMessage + "/" + code + ".";
         }
         catch (IOException e1)
         {
            log.debug("Unable to retrieve response message", e1);
         }
         throw new CannotConnectException(message, e);
      }

This second try may succeed depending on server/network condition even if conn.getOutputStream() in try clause fails.
>From a point of view of users (actually, JBossWS user),

- That may consume a connection with an empty body request
- On server side, they can't figure out if the empty request comes from this behaviour or just an empty request was wrongly/maliciously sent

So the request is going to be 

- Avoid connecting to a server in catch clause in case of connection failure

If that's impossible or too tricky to achieve JBREM-960 at a time, then

- Provide a system property switch to skip the conn.getResponseMessage()/conn.getResponseCode() lines


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-remoting-issues mailing list