You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Aki Yoshida (JIRA)" <ji...@apache.org> on 2012/07/27 11:25:35 UTC

[jira] [Resolved] (CXF-4437) Stack Overflow exception in org.apache.cxf.endpoint.ClientImpl when logging set to FINE

     [ https://issues.apache.org/jira/browse/CXF-4437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aki Yoshida resolved CXF-4437.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.7.0
                   2.5.5
                   2.4.9
         Assignee: Aki Yoshida

Removed the invocation context from the response context if present to protect against this kind of issue.

Additionally, removed the code for logging the response context to avoid revealing potentially sensitive information.


                
> Stack Overflow exception in org.apache.cxf.endpoint.ClientImpl when logging set to FINE
> ---------------------------------------------------------------------------------------
>
>                 Key: CXF-4437
>                 URL: https://issues.apache.org/jira/browse/CXF-4437
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.6.1
>         Environment: JDK 1.6.0_32
>            Reporter: Jason Pell
>            Assignee: Aki Yoshida
>             Fix For: 2.4.9, 2.5.5, 2.6.2, 2.7.0
>
>
> Hi,
> I can reproduce the issue in our code, but will probably struggle to
> create a test case.  
> I have narrowed down the culprit (in 2.6.1) to org.apache.cxf.endpoint.ClientImpl line 636
> The method protected Object[] processResult(Message message,
>                                    Exchange exchange,
>                                    BindingOperationInfo oi,
>                                    Map<String, Object> resContext)
> throws Exception {
> And the code:
> if (LOG.isLoggable(Level.FINE)) {
>                     LOG.fine("set responseContext to be" + resContext);
>                 }
> The code to add all the properties from the message to resContext, creates a recursive reference, because the message already has a reference to resContext.  This causes the logging to fail as when it tries to serialise the content of the map, it gets a stack overflow.
> The org.apache.cxf.invocation.context contains the ResponseContext and
> the ResponseContext contains the org.apache.cxf.invocation.context
> To prove my hypothesis I added the following code to replace the log call:
> HashMap contextMap = (HashMap)
> resContext.get("org.apache.cxf.invocation.context");
>                         HashMap responseContextMap = (HashMap)
> contextMap.get("ResponseContext");
>                         HashMap secondContextMap = (HashMap)
> responseContextMap.get("org.apache.cxf.invocation.context");
>                         if (secondContextMap != null) {
>                                 System.out.println("Oh boy here is the error!");
>                         }
> And I got the Oh boy here is the error! message back.
> The original stack trace is:
> java.lang.StackOverflowError
>         at java.util.HashMap$EntrySet.iterator(HashMap.java:950)
>         at java.util.AbstractMap.toString(AbstractMap.java:478)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
>         at java.lang.String.valueOf(String.java:2826)
>         at java.lang.StringBuilder.append(StringBuilder.java:115)
>         at java.util.AbstractMap.toString(AbstractMap.java:490)
> <snip>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira