You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Michael Pujos (Created) (JIRA)" <ji...@apache.org> on 2011/10/04 12:22:33 UTC

[jira] [Created] (HTTPCLIENT-1133) Super rare NPE in AbstractPooledConnAdapter

Super rare NPE in AbstractPooledConnAdapter
-------------------------------------------

                 Key: HTTPCLIENT-1133
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1133
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.1.1
         Environment: Android. Using repackaged httpcore 4.1.1 in an app obfuscated with Proguard. 
            Reporter: Michael Pujos
            Priority: Minor


I've got 1 report of exception below:

java.lang.NullPointerException
at com.bubblesoft.org.apache.http.impl.conn.AbstractPooledConnAdapter.getRoute(SourceFile:114)
at com.bubblesoft.org.apache.http.client.protocol.RequestClientConnControl.process(SourceFile:84)
at com.bubblesoft.org.apache.http.protocol.ImmutableHttpProcessor.process(SourceFile:108)
at com.bubblesoft.org.apache.http.protocol.HttpRequestExecutor.preProcess(SourceFile:174)
at com.bubblesoft.org.apache.http.impl.client.DefaultRequestDirector.execute(SourceFile:457)

Here's the line:

  public HttpRoute getRoute() {
        AbstractPoolEntry entry = getPoolEntry();
        assertValid(entry);
        return (entry.tracker == null) ? null : entry.tracker.toRoute();    // <= NPE here
    }


Looking briefly at the code and if the stack trace is legit (it seems to be), the only possible cause of a NPE on this line 
is if entry.tracker becomes null after the test entry.tracker == null happens.  It seems this could happen in the case  the request is aborted and AbstractPoolEntry.shutdownEntry() is
called in between, in another thread:

  protected void shutdownEntry() {
        tracker = null;
        state = null;
    }


--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1133) Super rare NPE in AbstractPooledConnAdapter

Posted by "Oleg Kalnichevski (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1133.
-------------------------------------------

    Resolution: Won't Fix

Michael

AbstractPooledConnAdapter has been deprecated in the 4.2 branch and I simply see no way of fixing it without breaking the API compatibility. The fix would involve making a non-final variable final.

The problem should no longer occur with the new pooling connection manager.

As soon as HttpClient 4.2-alpha1 is out, please give it a try.

Oleg
                
> Super rare NPE in AbstractPooledConnAdapter
> -------------------------------------------
>
>                 Key: HTTPCLIENT-1133
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1133
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.1.1
>         Environment: Android. Using repackaged httpcore 4.1.1 in an app obfuscated with Proguard. 
>            Reporter: Michael Pujos
>            Priority: Minor
>
> I've got 1 report of exception below:
> java.lang.NullPointerException
> at com.bubblesoft.org.apache.http.impl.conn.AbstractPooledConnAdapter.getRoute(SourceFile:114)
> at com.bubblesoft.org.apache.http.client.protocol.RequestClientConnControl.process(SourceFile:84)
> at com.bubblesoft.org.apache.http.protocol.ImmutableHttpProcessor.process(SourceFile:108)
> at com.bubblesoft.org.apache.http.protocol.HttpRequestExecutor.preProcess(SourceFile:174)
> at com.bubblesoft.org.apache.http.impl.client.DefaultRequestDirector.execute(SourceFile:457)
> Here's the line:
>   public HttpRoute getRoute() {
>         AbstractPoolEntry entry = getPoolEntry();
>         assertValid(entry);
>         return (entry.tracker == null) ? null : entry.tracker.toRoute();    // <= NPE here
>     }
> Looking briefly at the code and if the stack trace is legit (it seems to be), the only possible cause of a NPE on this line 
> is if entry.tracker becomes null after the test entry.tracker == null happens.  It seems this could happen in the case  the request is aborted and AbstractPoolEntry.shutdownEntry() is
> called in between, in another thread:
>   protected void shutdownEntry() {
>         tracker = null;
>         state = null;
>     }

--
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org