Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1573

Servlet request attributes are cleared before access log exchange completion listener runs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.0.26.Final
    • 2.0.21.Final
    • Servlet
    • None
    • Hide

      1. Use an access log pattern that includes attributes from servlet request
      2. Set attributes in servlet request
      3. Use servlet / filter that is not closing or reading the request input stream completely
      3. Use request with body (e.g. POST)

      Access log will not include attributes.

      Show
      1. Use an access log pattern that includes attributes from servlet request 2. Set attributes in servlet request 3. Use servlet / filter that is not closing or reading the request input stream completely 3. Use request with body (e.g. POST) Access log will not include attributes.

    Description

      In ServletInitialHandler...

              if (!exchange.isDispatched() && !(exchange.getConnection() instanceof MockServerConnection)) {
                  servletRequestContext.getOriginalResponse().responseDone();
                  servletRequestContext.getOriginalRequest().clearAttributes();
              }
      

      There are cases I'm seeing where responseDone() does not always trigger the exchange completion, because the request hasn't cleaned up yet, and exchange completion requires both the request and response to trigger completion. If the request is not completed, by the time the exchange completes, the attributes are already cleared, so the access log exchange completion listener does not see request attributes.

      This is frustrating for access logs, because I cannot reliably include servlet request attributes in them and have had to resort to awkward workarounds.

      Out of curiosity, why are request attributes cleared anyway?

      Feel free to reach out to my @redhat.com address if needed.

      Attachments

        Issue Links

          Activity

            People

              rhn-it-ahenning Alec Henninger (Inactive)
              rhn-it-ahenning Alec Henninger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: