You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2018/10/13 12:15:30 UTC

[Bug 62823] New: core_filter call mod_log_config before setting connec_rec to aborted

https://bz.apache.org/bugzilla/show_bug.cgi?id=62823

            Bug ID: 62823
           Summary: core_filter call mod_log_config before setting
                    connec_rec to aborted
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: contact@grandville.net
  Target Milestone: ---

I'm writing a module to translate http rest/json calls to pkcs11 protocol.
I found a curious behavior, if the client gives up his request, whereas I use
the %X flag is specified in my logFormat, the access log didn't report the
request as cancelled with a "X".

My module ends with several calls to ap_rwrite and return OK.
But in server\core_filters.c when the brigade send fails the brigade is cleaned
and request is logged before aborded status was updated

...
        rv = send_brigade_blocking(net->client_socket, bb,
                                   &(ctx->bytes_written), c);
        if (rv != APR_SUCCESS) {
            /* The client has aborted the connection */
            ap_log_cerror(APLOG_MARK, APLOG_TRACE1, rv, c,
                          "core_output_filter: writing data to the network");
            apr_brigade_cleanup(bb);
            c->aborted = 1;
            return rv;
        }
...

would it not be necessary to update connection state before calling
apr_brigade_cleanup ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62823] core_filter call mod_log_config before setting connec_rec to aborted

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62823

--- Comment #5 from Graham Leggett <mi...@apache.org> ---
Backported to v2.4.47:

http://svn.apache.org/viewvc?rev=1885573&view=rev

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62823] core_filter call mod_log_config before setting connec_rec to aborted

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62823

Ruediger Pluem <rp...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Ruediger Pluem <rp...@apache.org> ---
(In reply to Arnaud Grandville from comment #0)
> I'm writing a module to translate http rest/json calls to pkcs11 protocol.
> I found a curious behavior, if the client gives up his request, whereas I
> use the %X flag is specified in my logFormat, the access log didn't report
> the request as cancelled with a "X".
> 
> My module ends with several calls to ap_rwrite and return OK.
> But in server\core_filters.c when the brigade send fails the brigade is
> cleaned and request is logged before aborded status was updated
> 
> ...
>         rv = send_brigade_blocking(net->client_socket, bb,
>                                    &(ctx->bytes_written), c);
>         if (rv != APR_SUCCESS) {
>             /* The client has aborted the connection */
>             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, rv, c,
>                           "core_output_filter: writing data to the network");
>             apr_brigade_cleanup(bb);
>             c->aborted = 1;
>             return rv;
>         }
> ...
> 
> would it not be necessary to update connection state before calling
> apr_brigade_cleanup ?

Is the problem fixed if you reverse the order of

apr_brigade_cleanup(bb);

and 

c->aborted = 1;

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62823] core_filter call mod_log_config before setting connec_rec to aborted

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62823

Ruediger Pluem <rp...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk,
                   |                            |PatchAvailable

--- Comment #4 from Ruediger Pluem <rp...@apache.org> ---
Committed trunk patch as r1843939. Your version of the patch fits for 2.4.x
(trunk and 2.4.x are slightly different in this code section in the meantime)
and can be used while backporting to 2.4.x.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62823] core_filter call mod_log_config before setting connec_rec to aborted

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62823

Arnaud Grandville <co...@grandville.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62823] core_filter call mod_log_config before setting connec_rec to aborted

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62823

--- Comment #3 from Arnaud Grandville <co...@grandville.net> ---
(In reply to Ruediger Pluem from comment #1)
> (In reply to Arnaud Grandville from comment #0)
> > I'm writing a module to translate http rest/json calls to pkcs11 protocol.
> > I found a curious behavior, if the client gives up his request, whereas I
> > use the %X flag is specified in my logFormat, the access log didn't report
> > the request as cancelled with a "X".
> > 
> > My module ends with several calls to ap_rwrite and return OK.
> > But in server\core_filters.c when the brigade send fails the brigade is
> > cleaned and request is logged before aborded status was updated
> > 
> > ...
> >         rv = send_brigade_blocking(net->client_socket, bb,
> >                                    &(ctx->bytes_written), c);
> >         if (rv != APR_SUCCESS) {
> >             /* The client has aborted the connection */
> >             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, rv, c,
> >                           "core_output_filter: writing data to the network");
> >             apr_brigade_cleanup(bb);
> >             c->aborted = 1;
> >             return rv;
> >         }
> > ...
> > 
> > would it not be necessary to update connection state before calling
> > apr_brigade_cleanup ?
> 
> Is the problem fixed if you reverse the order of
> 
> apr_brigade_cleanup(bb);
> 
> and 
> 
> c->aborted = 1;

yes, that's right.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 62823] core_filter call mod_log_config before setting connec_rec to aborted

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62823

Arnaud Grandville <co...@grandville.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |contact@grandville.net

--- Comment #2 from Arnaud Grandville <co...@grandville.net> ---
Created attachment 36197
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36197&action=edit
On failed, update connection status before logging

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org