hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Crawford (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCORE-228) NullPointerException in AsyncNHttpServiceHandler on empty entity-enclosing request
Date Thu, 24 Jun 2010 10:52:52 GMT

    [ https://issues.apache.org/jira/browse/HTTPCORE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12882125#action_12882125
] 

Sam Crawford commented on HTTPCORE-228:
---------------------------------------

Ah ha! I think I know why you've been having difficulty reproducing the issue.

The issue only occurs when:

1) You're issuing a POST request (the content length is irrelevant actually); and
2) You do not have a handler defined for the URI being accessed in the schema registry

In your test cases (e.g. with NHttpSSLServer) there is a wildcard handler, which is why the
issue was never manifesting itself. Also, if you execute the same query but as a GET, the
HttpCore will return a "501 Not Implemented"

So to repeat this, just modify your NHttpSSLServer example like the following:

        reqistry.register("/test", new HttpFileHandler(args[0]));

And then run the following curl command:

curl -v -k -d "foo=bar" https://192.168.0.1:8080/

Obviously the workaround is to define a wildcard handler in the registry, and this is probably
what I'll do for the moment.

Sam

> NullPointerException in AsyncNHttpServiceHandler on empty entity-enclosing request
> ----------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-228
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-228
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0.1
>         Environment: [root@dev3 DCS]# uname -a
> Linux dev3 2.6.18-164.9.1.el5 #1 SMP Tue Dec 15 20:57:57 EST 2009 x86_64 x86_64 x86_64
GNU/Linux
> [root@dev3 DCS]# java -version
> java version "1.6.0_17"
> Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)
>            Reporter: Sam Crawford
>
> When a client sends an entity-enclosing request, but does not include an entity, an IOReactorException
is thrown which in turns terminates the server. The cause appears to be a missing null-check
around line 317 in the following code:
> 313         ConsumingNHttpEntity consumingEntity = connState.getConsumingEntity();
> 314
> 315         try {
> 316
> 317             consumingEntity.consumeContent(decoder, conn);
> 318             if (decoder.isCompleted()) {
> 319                 conn.suspendInput();
> 320                 processRequest(conn, request);
> 321             }
> The issue can be reproduced using the following:
> [sam@dev3 ~]$ curl -v -d "" https://proj.acmecorp.com/
> * About to connect() to proj.acmecorp.com port 443
> *   Trying 192.168.254.22... connected
> * Connected to proj.acmecorp.com (192.168.254.22) port 443
> * SSL certificate verify ok.
> > POST / HTTP/1.1
> > User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b
zlib/1.2.3 libidn/0.6.5
> > Host: proj.acmecorp.com
> > Accept: */*
> > Content-Length: 0
> > Content-Type: application/x-www-form-urlencoded
> >
> (No response is ever received)
> Complete stacktrace:
> INFO com.acmecorp.proj.http.HttpSSLServer: Connection open: [proj.acmecorp.com/192.168.254.22:47992]
> ERROR com.acmecorp.proj.http.HttpSSLServer: I/O error
> org.apache.http.nio.reactor.IOReactorException: I/O dispatch worker terminated abnormally
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:326)
>         at com.acmecorp.proj.http.HttpSSLServer$1.run(HttpSSLServer.java:162)
> Caused by: java.lang.NullPointerException
>         at org.apache.http.nio.protocol.AsyncNHttpServiceHandler.inputReady(AsyncNHttpServiceHandler.java:317)
>         at org.apache.http.impl.nio.DefaultNHttpServerConnection.consumeInput(DefaultNHttpServerConnection.java:179)
>         at org.apache.http.impl.nio.SSLServerIOEventDispatch.inputReady(SSLServerIOEventDispatch.java:225)
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:153)
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:314)
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:294)
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:256)
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:96)
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:556)
>         at java.lang.Thread.run(Thread.java:619)
> INFO com.acmecorp.proj.http.HttpSSLServer: Shutdown HTTP server

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message