Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 51383 invoked from network); 2 Nov 2007 21:40:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2007 21:40:06 -0000 Received: (qmail 6332 invoked by uid 500); 2 Nov 2007 21:39:54 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 5982 invoked by uid 500); 2 Nov 2007 21:39:53 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 5971 invoked by uid 99); 2 Nov 2007 21:39:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2007 14:39:53 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of slowhog@gmail.com designates 209.85.134.191 as permitted sender) Received: from [209.85.134.191] (HELO mu-out-0910.google.com) (209.85.134.191) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2007 21:39:56 +0000 Received: by mu-out-0910.google.com with SMTP id i10so938088mue for ; Fri, 02 Nov 2007 14:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; bh=3/4qq6aO+Cinho3KdQSardjKzNBKhJCHH+VXtONgMIo=; b=th6NT/32lnNCODfLq4as8Toh5sAZAzh1x49wweMuVUzPWAB3v3JmUfSKu318NBBMCivP88E5qsgww6KGTAVo7CmTVNQKfZSDTFj+S2i8FZqY/k55CtZDU/40lPxP6yQHeWFquLHLOYIj3n59T2b8YVE0hz/GD3oSgVTfV0Rjsx4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=Z0tmdB+5NfkFA0G1pntwdKBO7oY/KeQMKrxQc9hPmFijSSd6a3a5tu8jGLR3NJ1L9KQPHGsODhiz946oc9vU2YesQMxMO9FLb3ZVtgbHadjdWewNu5pYsp97ysAZqi70CqlpWJ2WfkO+wEVBzg0rhm/EYsDwJJvnqfpBw6TBA7A= Received: by 10.82.171.16 with SMTP id t16mr4460947bue.1194039573385; Fri, 02 Nov 2007 14:39:33 -0700 (PDT) Received: by 10.82.114.7 with HTTP; Fri, 2 Nov 2007 14:39:33 -0700 (PDT) Message-ID: <369011d00711021439g7261df16m7dd28df0d2ae3a62@mail.gmail.com> Date: Fri, 2 Nov 2007 14:39:33 -0700 From: "Henry Jen" Sender: slowhog@gmail.com To: "APR Developer List" Subject: [PATCH] testpoll fix for Solaris port backend [was: Re: Showstoppers to apr release(?)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_21724_13264286.1194039573368" X-Google-Sender-Auth: 61d4a9a48b176208 X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_21724_13264286.1194039573368 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Attached is a patch fix the testpoll issues found on Solaris. It combines the previous fix for removing a poll. This patch basically minimize the timing window to make a port_associate before someone is trying to retrieve events from the port. Cheers, Henry On 10/30/07, Henry Jen wrote: > On 10/30/07, Henry Jen wrote: > > On 10/29/07, William A. Rowe, Jr. wrote: > > > William A. Rowe, Jr. wrote: > > > > > > > * Solaris 10, testpoll.c:314 we are failing with only APR_POLLOUT when we > > > > had expected both APR_POLLIN and APR_POLLOUT to be signaled. Ideas? > > > > > > > Seems like an issue with event port library, to associate with both > > POLLIN and POLLOUT event does not work on Solaris. I had created a > > simple test program as attached, and I noted that if we change the > > associate to POLLIN only, we will get the POLLIN event. > > > > Disable detection of port_create from configure.in to force using poll > > on Solaris pass the test. > > > > I am forwarding this to OpenSolaris developers and hopefully will get > > some explanation. > > > > > > After some more investigation and read into the man page more carefully, > I found the following explains the issue. The following discussion is > based on the test code attached with previous email. > > Quoted from the man page of port_associate: > > > > Objects of type PORT_SOURCE_FD are file descriptors. The > > > event types for PORT_SOURCE_FD objects are described in > > > poll(2). At most one event notification will be generated > > > per associated file descriptor. For example, if a file > > > descriptor is associated with a port for the POLLRDNORM > > > event and data is available on the file descriptor at the > > > time the port_associate() function is called, an event is > > > immediately sent to the port. > > This explains the first event only has POLLOUT flagged, as sendto is > called after port_associate. By switching the order, we get an event > with POLLIN and POLLOUT both flagged. > > > > If data is not yet available, > > > one event is sent to the port when data first becomes avail- > > > able. > > > > > > When an event for a PORT_SOURCE_FD object is retrieved, the > > > object no longer has an association with the port. The > > > event can be processed without the possibility that another > > > thread can retrieve a subsequent event for the same object. > > > After processing of the file descriptor is completed, the > > > port_associate() function can be called to reassociate the > > > object with the port. > > This indicates another call to port_associate is needed within the while > loop to continue receive events interested. By adding port_associate > into the while loop, the program will get the POLLIN event at the second > attempt without changing the order of sendto call as mentioned above. > > So a hack to fix to testpoll.c is to call apr_pollset_add after send_msg. > > A better fix for Solaris, IMHO, is don't call port_associate in > apr_pollset_add but leave it to apr_pollset_poll by putting the > request into the add_ring. Attached patch fix get over this issue. > However, testpoll still have other existing failures on my Solaris > Developer Express system. > > testpoll : |Line 343: expected <0>, but saw <70015> > |Line 523: expected <0>, but saw <70015> > |Line 615: expected <0>, but saw <70015> > FAILED 3 of 19 > Failed Tests Total Fail Failed % > =================================================== > testpoll 19 3 15.79% > > HTH, > Henry > > ------=_Part_21724_13264286.1194039573368 Content-Type: text/x-patch; name=solaris_poll.diff Content-Transfer-Encoding: base64 X-Attachment-Id: f_f8j860xj Content-Disposition: attachment; filename=solaris_poll.diff SW5kZXg6IHBvbGwvdW5peC9wb3J0LmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT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SQ0Vf RkQsIGZkLCAKLSAgICAgICAgICAgICAgICAgICAgICAgICBnZXRfZXZlbnQoZGVzY3JpcHRvci0+ cmVxZXZlbnRzKSwgKHZvaWQgKillbGVtKTsKKyAgICBpZiAoYXByX2F0b21pY19yZWFkMzIoJnBv bGxzZXQtPndhaXRpbmcpKSB7CisgICAgICAgIHJlcyA9IHBvcnRfYXNzb2NpYXRlKHBvbGxzZXQt PnBvcnRfZmQsIFBPUlRfU09VUkNFX0ZELCBmZCwgCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGdldF9ldmVudChkZXNjcmlwdG9yLT5yZXFldmVudHMpLCAodm9pZCAqKWVsZW0pOwogCi0g ICAgaWYgKHJlcyA8IDApIHsKLSAgICAgICAgcnYgPSBBUFJfRU5PTUVNOwotICAgICAgICBBUFJf UklOR19JTlNFUlRfVEFJTCgmKHBvbGxzZXQtPmZyZWVfcmluZyksIGVsZW0sIHBmZF9lbGVtX3Qs IGxpbmspOwotICAgIH0KKyAgICAgICAgaWYgKHJlcyA8IDApIHsKKyAgICAgICAgICAgIHJ2ID0g QVBSX0VOT01FTTsKKyAgICAgICAgICAgIEFQUl9SSU5HX0lOU0VSVF9UQUlMKCYocG9sbHNldC0+ ZnJlZV9yaW5nKSwgZWxlbSwgcGZkX2VsZW1fdCwgbGluayk7CisgICAgICAgIH0KKyAgICAgICAg ZWxzZSB7CisgICAgICAgICAgICBwb2xsc2V0LT5uZWx0cysrOworICAgICAgICAgICAgQVBSX1JJ TkdfSU5TRVJUX1RBSUwoJihwb2xsc2V0LT5xdWVyeV9yaW5nKSwgZWxlbSwgcGZkX2VsZW1fdCwg bGluayk7CisgICAgICAgIH0KKyAgICB9IAogICAgIGVsc2UgewogICAgICAgICBwb2xsc2V0LT5u ZWx0cysrOwotICAgICAgICBBUFJfUklOR19JTlNFUlRfVEFJTCgmKHBvbGxzZXQtPnF1ZXJ5X3Jp bmcpLCBlbGVtLCBwZmRfZWxlbV90LCBsaW5rKTsKKyAgICAgICAgQVBSX1JJTkdfSU5TRVJUX1RB SUwoJihwb2xsc2V0LT5hZGRfcmluZyksIGVsZW0sIHBmZF9lbGVtX3QsIGxpbmspOwogICAgIH0K IAogICAgIHBvbGxzZXRfdW5sb2NrX3JpbmdzKCk7CkBAIC0xOTIsNiArMjAyLDcgQEAKICAgICBw ZmRfZWxlbV90ICplcDsKICAgICBhcHJfc3RhdHVzX3QgcnYgPSBBUFJfU1VDQ0VTUzsKICAgICBp bnQgcmVzOworICAgIGludCBlcnI7CiAKICAgICBwb2xsc2V0X2xvY2tfcmluZ3MoKTsKIApAQCAt MjA1LDYgKzIxNiw3IEBACiAgICAgcmVzID0gcG9ydF9kaXNzb2NpYXRlKHBvbGxzZXQtPnBvcnRf ZmQsIFBPUlRfU09VUkNFX0ZELCBmZCk7CiAKICAgICBpZiAocmVzIDwgMCkgeworICAgICAgICBl cnIgPSBlcnJubzsKICAgICAgICAgcnYgPSBBUFJfTk9URk9VTkQ7CiAgICAgfQogCkBAIC0yMzMs NiArMjQ1LDkgQEAKICAgICAgICAgICAgICAgICBBUFJfUklOR19SRU1PVkUoZXAsIGxpbmspOwog ICAgICAgICAgICAgICAgIEFQUl9SSU5HX0lOU0VSVF9UQUlMKCYocG9sbHNldC0+ZGVhZF9yaW5n KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcCwgcGZkX2VsZW1fdCwg bGluayk7CisgICAgICAgICAgICAgICAgaWYgKEVOT0VOVCA9PSBlcnIpIHsKKyAgICAgICAgICAg ICAgICAgICAgcnYgPSBBUFJfU1VDQ0VTUzsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAg ICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTI2OCw2ICsyODMsOCBA QAogCiAgICAgcG9sbHNldF9sb2NrX3JpbmdzKCk7CiAKKyAgICBhcHJfYXRvbWljX2luYzMyKCZw b2xsc2V0LT53YWl0aW5nKTsKKwogICAgIHdoaWxlICghQVBSX1JJTkdfRU1QVFkoJihwb2xsc2V0 LT5hZGRfcmluZyksIHBmZF9lbGVtX3QsIGxpbmspKSB7CiAgICAgICAgIGVwID0gQVBSX1JJTkdf RklSU1QoJihwb2xsc2V0LT5hZGRfcmluZykpOwogICAgICAgICBBUFJfUklOR19SRU1PVkUoZXAs IGxpbmspOwpAQCAtMjkxLDYgKzMwOCw5IEBACiAgICAgcmV0ID0gcG9ydF9nZXRuKHBvbGxzZXQt PnBvcnRfZmQsIHBvbGxzZXQtPnBvcnRfc2V0LCBwb2xsc2V0LT5uYWxsb2MsCiAgICAgICAgICAg ICAgICAgICAgICZuZ2V0LCB0dnB0cik7CiAKKyAgICAvKiBkZWNyZWFzZSB0aGUgd2FpdGluZyBB U0FQIHRvIHJlZHVjZSB0aGUgd2luZG93IGZvciBjYWxsaW5nIAorICAgICAgIHBvcnRfYXNzb2Np YXRlIHdpdGhpbiBhcHJfcG9sbHNldF9hZGQoKSAqLworICAgIGFwcl9hdG9taWNfZGVjMzIoJnBv bGxzZXQtPndhaXRpbmcpOwogICAgICgqbnVtKSA9IG5nZXQ7CiAKICAgICBpZiAocmV0ID09IC0x KSB7CkBAIC00NjQsNiArNDg0LDcgQEAKICAgICAgICAgICAgIGlmIChydikgewogICAgICAgICAg ICAgICAgIHJldHVybiBydjsKICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJ2ID0gYXByX3Bv bGxjYl9hZGQocG9sbGNiLCBwb2xsZmQpOwogICAgICAgICB9CiAgICAgfQogCg== ------=_Part_21724_13264286.1194039573368--