apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44550] New: Solaris sendfilev() handling - EINTR appears to have sent data causing Apache2 to duplicate output chunks
Date Thu, 06 Mar 2008 20:08:32 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=44550

           Summary: Solaris sendfilev() handling - EINTR appears to have
                    sent data causing Apache2 to duplicate output chunks
           Product: APR
           Version: 0.9.12
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: major
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: declanw@is.bbc.co.uk


Apache 2.0.59 on Solaris 10 Update 4 (Generic_120011-14)

Corrupt HTTP/1.1 chunking output seen. Corresponded exactly to the duplication
of the contents of a file descriptor (an SSI file inclusion) passed as an
argument to sendfilev() (without a preceding chunk header the browsers barfed)

The problem was *only* seen when the machine was under I/O stress and
sendfilev() returned EINTR according to truss. There were never problems
without EINTR. Disabling sendfile support in a .htaccess made the problem
disappear.

The sun manual page :
http://docs.sun.com/app/docs/doc/816-5172/sendfilev-3ext?a=view
says EINTR will not have sent data. However, if you compare the Apache
sendfilev() handling to the Samba sendfilev() handling you see different
handling of EINTR.

Apache: srclib/apr/network_io/unix/sendrecv.c

    do {
        /* Clear out the repeat */
        repeat = 0;

        /* socket, vecs, number of vecs, bytes written */
        rv = sendfilev(sock->socketdes, sfv, vecs, &nbytes);

        if (rv == -1 && errno == EAGAIN) {
            if (nbytes) {
                rv = 0;
            }
            else if (!arv &&
                     apr_is_option_set(sock->netmask, APR_SO_TIMEOUT) == 1) {
                apr_status_t t = apr_wait_for_io_or_timeout(NULL, sock, 0);

                if (t != APR_SUCCESS) {
                    *len = 0;
                    return t;
                }

                arv = 1;
                repeat = 1;
            }
        }
    } while ((rv == -1 && errno == EINTR) || repeat);

Samba:

/*
 * Although not listed in the API error returns, this is almost certainly
 * a slow system call and will be interrupted by a signal with EINTR. JRA.
 */

        xferred = 0;

        #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
&& defined(HAVE_SENDFILEV64)
                                nwritten = sendfilev64(tofd, vec, sfvcnt,
&xferred);
        #else
                                nwritten = sendfilev(tofd, vec, sfvcnt,
&xferred);
        #endif
                        if (nwritten == -1 && errno == EINTR) {
                                if (xferred == 0)
                                        continue; /* Nothing written yet. */
                                else
                                        nwritten = xferred;
                        }


I have also raised a bug with Sun over the documentation of their error
behaviour


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message