Last modified: 2012-04-12 13:54:36 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T29658, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27658 - SquidPurgeClient fails on FreeBSD; incorrect constants + MSG_EOR w/ SOCK_STREAM
SquidPurgeClient fails on FreeBSD; incorrect constants + MSG_EOR w/ SOCK_STREAM
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.16.x
All FreeBSD
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-23 12:34 UTC by Laurence 'GreenReaper' Parry
Modified: 2012-04-12 13:54 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Laurence 'GreenReaper' Parry 2011-02-23 12:34:18 UTC
On FreeBSD, the new SquidPurgeClient fails to write to the socket it opens (and thus fails to purge from the cache) for a couple of reasons:

* On FreeBSD, EAGAIN is 35, and EINPROGRESS is 36, which do not match the (linux?) constants defined in SquidPurgeClient.php, thus causing getSocket() to return false when it actually created the socket correctly:
http://fxr.watson.org/fxr/source/sys/errno.h?v=DFBSD

* On FreeBSD, setting MSG_EOR on a SOCK_STREAM socket (as done in doWrites()) will result in EINVAL, so even if it gets the sockets, writing to them fails:
http://fxr.watson.org/fxr/source/kern/uipc_socket.c?v=OPENBSD;im=bigexcerpts#L378
I believe you are only meant to use MSG_EOR with SOCK_SEQPACKET.

Adjusting the constants to match those of FreeBSD and changing the $flags parameter to 0 in doWrites fixed this problem for me on FreeBSD 8.1-RELEASE-p1. Perhaps there's a better way to detect these platform-specific constants?

---

For what it's worth, I also added in a few more writes for Varnish, because it won't purge gzip and deflate versions unless you ask. Not sure if it's required for Squid (and there might be a better way to do this in VCL, too), but it was much easier with the new architecture:

public function queuePurge( $url ) {
  $urlparts = parse_url(str_replace( "\n", '', $url ));
  $msg =  'PURGE ' . $urlparts['path'] . " HTTP/1.0\r\n" .
          'Host: ' . $urlparts['host'] . "\r\n".
          "Connection: Keep-Alive\r\n" .
          "Proxy-Connection: Keep-Alive\r\n" .
          'User-Agent: ' . Http::userAgent() . ' ' . __CLASS__ . "\r\n";
  $this->requests[] = $msg . "\r\n";
  $this->requests[] = $msg . "Accept-Encoding: gzip\r\n\r\n";
  $this->requests[] = $msg . "Accept-Encoding: deflate\r\n\r\n";
...

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links