Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [servlet-dev] [cdi-dev] HTTP 500 error incompatible processing

Hi,

This is one of those areas where there is still a need for further clarity in the specification. I don't recall (and can't find) anything that would disagree with your assessment.

Mark


On 06/06/2022 13:02, arjan tijms wrote:
Hi,

I implemented Servlet in Piranha, though I’m not sure if that makes me a true expert. My understanding at least (which may be wrong), is that when an exception is thrown in async code, the onError handler is responsible for setting a 500 or not.

So I opted, like WildFly, not to have a 500 automatically send by the container. I did had my doubts here too, and there’s no test in the Servlet TCK asserting this.

Maybe Mark or Greg can comment here? (Servlet list cc’ed)

Kind regards,
Arjan Tijms



On Monday, June 6, 2022, Matej Novotny <manovotn@xxxxxxxxxx <mailto:manovotn@xxxxxxxxxx>> wrote:

    Helo,

    this is a good question.
    I took a look at
    ApplicationContextAsyncListenerTest.testApplicationContextActiveOnError
    and run it on WFLY.
    To my own surprise, the return code I saw there during debug was 200.

    I am no servlet expert so someone else might jump in and explain how
    this is supposed to work.
    The servlet in question (AsyncServlet) doesn't throw any exception
    itself so theoretically it returns successfully while the async
    processing and delegation continues.
    It delegates to an instance of `ExecutorService` and uses
    `SimpleAsyncListener` to monitor the result. From within the
    listener, I can correctly detect the "onError" method being triggered.

    I am going to try to look into servlet spec to get a hang of what
    should be returned in this case.
    Either we have the test wrong (but both, WFLY and Liberty pass,
    supposedly also GF) or some of the server behaviors are wrong.
    If someone knows more, feel free to jump in and correct my
    assumptions :)

    Matej

    On Sat, Jun 4, 2022 at 3:05 AM Alfonso Altamirano
    <alfonso.altamirano@xxxxxxxxxxx> wrote:

        Hi guys,

        Again with something related to the CDI-TCK execution. I'm using
        the version 4.0.1 and when executing I'm seeing the following error:

          [mvn.test]
        com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException:
        500 Internal Server Error for
        http://localhost:8080/ApplicationContextAsyncListenerTestf171a3d3289dcf8237159d936219ff9c87d85db/AsyncServlet?test=error
        <http://localhost:8080/ApplicationContextAsyncListenerTestf171a3d3289dcf8237159d936219ff9c87d85db/AsyncServlet?test=error>

        The source of this issue came from the following tests:

          * org.jboss.cdi.tck.tests.context.application.async.ApplicationContextAsyncListenerTest.testApplicationContextActiveOnError
          * org.jboss.cdi.tck.tests.context.conversation.determination.ConversationDeterminationTest.testConversationDetermination
          * org.jboss.cdi.tck.tests.context.request.async.RequestContextAsyncListenerTest.testRequestContextActiveOnError
          * org.jboss.cdi.tck.tests.context.session.async.SessionContextAsyncListenerTest.testSessionContextActiveOnError

        I'm not sure if this is correct because when checking details of
        the test I saw that the Servlet called is going to generate a
        ServletException that is going to cause an error 500 from the
        Server, but the following block of code from the htmlunit
        implementation make me think that I need to configure something
        to disable the throw of the FailingHttpStatusCodeException. Do
        you know how to pass this exception? or Do you know what to
        config to pass this tests?

        this is the block of code from the htmlunit implementation:
        WebClient:

        public void throwFailingHttpStatusCodeExceptionIfNecessary(WebResponse webResponse) {
             int statusCode = webResponse.getStatusCode();
             boolean successful = statusCode >=200 && statusCode <300 || statusCode ==305 || statusCode ==304;
             if (this.getOptions().isThrowExceptionOnFailingStatusCode() && !successful) {
                 throw new FailingHttpStatusCodeException(webResponse);
        }
        }


        regards

        _______________________________________________
        cdi-dev mailing list
        cdi-dev@xxxxxxxxxxx <mailto:cdi-dev@xxxxxxxxxxx>
        To unsubscribe from this list, visit
        https://www.eclipse.org/mailman/listinfo/cdi-dev
        <https://www.eclipse.org/mailman/listinfo/cdi-dev>


_______________________________________________
servlet-dev mailing list
servlet-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/servlet-dev


Back to the top