{"action":"created","issue":{"url":"https://api.github.com/repos/letsencrypt/boulder/issues/1033","labels_url":"https://api.github.com/repos/letsencrypt/boulder/issues/1033/labels{/name}","comments_url":"https://api.github.com/repos/letsencrypt/boulder/issues/1033/comments","events_url":"https://api.github.com/repos/letsencrypt/boulder/issues/1033/events","html_url":"https://github.com/letsencrypt/boulder/pull/1033","id":113126614,"number":1033,"title":"Add reconnect loop to AMQP RPC","user":{"login":"jsha","id":220205,"avatar_url":"https://avatars.githubusercontent.com/u/220205?v=3","gravatar_id":"","url":"https://api.github.com/users/jsha","html_url":"https://github.com/jsha","followers_url":"https://api.github.com/users/jsha/followers","following_url":"https://api.github.com/users/jsha/following{/other_user}","gists_url":"https://api.github.com/users/jsha/gists{/gist_id}","starred_url":"https://api.github.com/users/jsha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsha/subscriptions","organizations_url":"https://api.github.com/users/jsha/orgs","repos_url":"https://api.github.com/users/jsha/repos","events_url":"https://api.github.com/users/jsha/events{/privacy}","received_events_url":"https://api.github.com/users/jsha/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/letsencrypt/boulder/labels/r=rolandshoemaker","name":"r=rolandshoemaker","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/letsencrypt/boulder/milestones/6","html_url":"https://github.com/letsencrypt/boulder/milestones/General%20Availability","labels_url":"https://api.github.com/repos/letsencrypt/boulder/milestones/6/labels","id":1121569,"number":6,"title":"General Availability","description":"","creator":{"login":"bdaehlie","id":84762,"avatar_url":"https://avatars.githubusercontent.com/u/84762?v=3","gravatar_id":"","url":"https://api.github.com/users/bdaehlie","html_url":"https://github.com/bdaehlie","followers_url":"https://api.github.com/users/bdaehlie/followers","following_url":"https://api.github.com/users/bdaehlie/following{/other_user}","gists_url":"https://api.github.com/users/bdaehlie/gists{/gist_id}","starred_url":"https://api.github.com/users/bdaehlie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdaehlie/subscriptions","organizations_url":"https://api.github.com/users/bdaehlie/orgs","repos_url":"https://api.github.com/users/bdaehlie/repos","events_url":"https://api.github.com/users/bdaehlie/events{/privacy}","received_events_url":"https://api.github.com/users/bdaehlie/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":132,"state":"open","created_at":"2015-05-20T16:53:19Z","updated_at":"2015-10-27T20:25:16Z","due_on":"2015-11-20T08:00:00Z","closed_at":null},"comments":9,"created_at":"2015-10-24T01:40:07Z","updated_at":"2015-10-28T04:00:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/letsencrypt/boulder/pulls/1033","html_url":"https://github.com/letsencrypt/boulder/pull/1033","diff_url":"https://github.com/letsencrypt/boulder/pull/1033.diff","patch_url":"https://github.com/letsencrypt/boulder/pull/1033.patch"},"body":"Fixes #867.\r\n\r\nReview tip: Append &w=1 to diff URL to suppress whitespace diffs, [like so](https://github.com/letsencrypt/boulder/pull/1033/files?w=1).\r\n\r\nReview tip: Jump straight to amqp-rpc.go and read it first, then the rest.\r\n\r\nPreviously, only `AmqpRPCServer` knew how to reconnect a channel. I pulled that logic out into `connect` and `reconnect`, which are now shared by server and client RPC code.\r\n\r\nPreviously, `AmqpRPCClient` needed to be created with a `Channel`, so that it could share with `AmqpRPCServer`. Now each client or server instance has its own channel, which is managed independently. Users of this code don't need to know about Channels anymore. Consequently, a lot of main.go files changed as I removed this dependency.\r\n\r\nPreviously, `AmqpRPCServer` managed reconnects by nesting everything inside an awkward doubly-nested for loop. Now, the loop for both client and server is only one deep, and we enter a second loop only when reconnecting (and that logic is tucked away neatly into `reconnect`).\r\n\r\nI also turned some logging statements into errors that get returned to a parent function, which is responsible for logging them. This reduced the need to pass through a logger in the new `connect` function and simplified the code.\r\n\r\nFor testing, I added code to the integration test that creates a local `ncat` tunnel from 5673 to 5672, and made boulder-config use that tunnel instead of a direct connection to RabbitMQ. This allows us to simulate a network failure easily. Note: right now we simulate this failure at a \"convenient\" time, after the Node test finishes issuing and before the Python client begins. I considered triggering the failure at random times to catch more issues, but decided that was likely to cause test nondeterminism. Instead one of us should locally tweak the test to fire at random times, run the test several times and see what problems pop out.\r\n\r\nNote: still needs unittests, but wanted to get this up for some eyeballs while I work on them."},"comment":{"url":"https://api.github.com/repos/letsencrypt/boulder/issues/comments/151715649","html_url":"https://github.com/letsencrypt/boulder/pull/1033#issuecomment-151715649","issue_url":"https://api.github.com/repos/letsencrypt/boulder/issues/1033","id":151715649,"user":{"login":"jmhodges","id":598,"avatar_url":"https://avatars.githubusercontent.com/u/598?v=3","gravatar_id":"","url":"https://api.github.com/users/jmhodges","html_url":"https://github.com/jmhodges","followers_url":"https://api.github.com/users/jmhodges/followers","following_url":"https://api.github.com/users/jmhodges/following{/other_user}","gists_url":"https://api.github.com/users/jmhodges/gists{/gist_id}","starred_url":"https://api.github.com/users/jmhodges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmhodges/subscriptions","organizations_url":"https://api.github.com/users/jmhodges/orgs","repos_url":"https://api.github.com/users/jmhodges/repos","events_url":"https://api.github.com/users/jmhodges/events{/privacy}","received_events_url":"https://api.github.com/users/jmhodges/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T04:00:15Z","updated_at":"2015-10-28T04:00:15Z","body":"LGTM"}}