Page MenuHomePhabricator

Test HTCP purging in labs
Closed, ResolvedPublic

Description

From https://github.com/wikimedia/restbase/pull/317#issuecomment-142017194:

Before we enable HTCP purging in production, it would be useful to test the HTCP purge logic manually (with a small test script around the module) in labs. Afaik there is a HTCP purge daemon running there (possibly unicast, though), along with Varnishes we can log requests from (by running vanishncsa). By testing in labs first, we can make sure that the HTCP daemon doesn't explode when it sees our lovingly crafted packets. Having that happen in production would make for a bit more hectic than necessary.

Event Timeline

GWicke raised the priority of this task from to High.
GWicke updated the task description. (Show Details)
GWicke added a project: RESTBase.

According to the instance listing for deployment-prep at https://wikitech.wikimedia.org/wiki/Special:NovaInstance, deployment-cache-text04 should be the Varnish instance we are interested in.

deployment-cache-text04 does have the vhtcpd purger daemon up and running, but it's mutlicast config points to the production one:

root@deployment-cache-text04:/# ps -ef | grep htcp
vhtcpd    1662     1  0 Aug18 ?        00:01:39 /usr/sbin/vhtcpd -m 239.128.0.112 -c 127.0.0.1:80 -c 127.0.0.1:3128 start

The IP is hard-coded in the Puppet manifest.

I have tried to issue some requests to it, but couldn't see anything in the varnish logs.

I've built vhtcpd locally, and started it with the command:

./src/vhtcpd -m 224.0.0.0 -c 127.0.0.1:8000 startfg

Then, I've used our command-line utility to send HTCP packets like this:

node ./maintenance/purge.js 127.0.0.1:4827 http://test.com/test.html

Finally, I've made up a very simple HTTP server on 8000 port, that just logs the contents of a received request, so, for the previous HTCP request I get the following HTTP request from daemon:

{
    method: 'purge',
    uri: '/test.html'
    headers: {
        host: 'test.com',
        'user-agent': 'vhtcpd'
    }
}

This appears to be correct, and vhtcpd daemon doesn't crash, so at least this part of the puzzle seem to work.

To test that sending HTCP to a multicast address locally works, I've had to change the HTCP purger code a little bit to enable an IP_MULTICAST_LOOP option. After enabling it, I can join vhtcpd to any multicast group, and use it to send HTCP packets, everything works correctly.

As I understand, in production we don't need to loopback, right?

Thnx for the feedback @Pchelolo! I forgot to mention in my previous comment that in spite of the production multicast IP in labs, I could verify that packets are successfully received and correctly interpreted by vhtcpd.

The HTTP requests produced are indeed correct @Pchelolo.

As I understand, in production we don't need to loopback, right?

Nope, that's already set up there.

I could verify that vhtcpd in labs successfully relays the purge request to Varnish:

deployment-cache-text04.deployment-prep.eqiad.wmflabs 94 2015-09-23T15:28:08 0.000097036 127.0.0.1 miss/204 0 PURGE http://en.wikipedia.beta.wmflabs.org/wiki/Main_Page - - - - vhtcpd