Merge lp://staging/~sinzui/launchpad/shutdown-mailman into lp://staging/launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 16412
Proposed branch: lp://staging/~sinzui/launchpad/shutdown-mailman
Merge into: lp://staging/launchpad
Diff against target: 135 lines (+50/-27)
3 files modified
lib/lp/services/mailman/monkeypatches/xmlrpcrunner.py (+11/-3)
lib/lp/services/mailman/tests/test_xmlrpcrunner.py (+37/-0)
lib/lp/testing/smtpd.py (+2/-24)
To merge this branch: bzr merge lp://staging/~sinzui/launchpad/shutdown-mailman
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+141967@code.staging.launchpad.net

Commit message

Update the mailman xmlrpc runner to exit early when the service is stopped.

Description of the change

During the last few deployments (possibly longer) mailman hasn't shut
down cleaning. We run the initscript stop -
https://pastebin.canonical.com/45791/ - and the mailmanctl process is
still running and needs to manually killed. This makes mailman a tough
target for a "nodowntime" deployment as it would block on failing to
shut down.

RULES

    Pre-implementation: gnuoy
    * We see that the xmlrpc queue runner continues to run after the rest
      of mailman has shutdown.
      * Other queues process 1 file/message per oneloop() and the longest
        we have seen a process run is about 3 minutes.
      * The xmlrpc runner does not process files, it make a series of
        network calls that take an average of 15 minutes to complete
        per oneloop().
    * The base runner class provides shortcircuit() which can be checked
      by oneloop() to exit early. The get_subscriptions() method takes
      up most of the time oneloop() uses; the method is actually doing
      batching work in a subloop. The subloop can also check to exit early.

QA

    * Stop staging's mailman to verify that shutdown completes quickly,
      and that it can be restarted without a paused process. We have
      verified that staging behaves exactly like production, taking
      between 5 and 15 minutes to shutdown the xmlrpc queue, and the main
      mailman process is left behind.

LINT

    lib/lp/services/mailman/monkeypatches/xmlrpcrunner.py
    lib/lp/services/mailman/tests/test_xmlrpcrunner.py

LoC

    I have more than 10,000 lines of credit this week.

TEST

    ./bin/test -vc -t OneLoop lp.services.mailman

IMPLEMENTATION

I added a call to runner._shortcircuit() to the _get_subscriptions() method.
I did the same to the _oneloop() method, but I changed the method to
loop over the all the methods to avoid repeated guards around each
method.
    lib/lp/services/mailman/monkeypatches/xmlrpcrunner.py
    lib/lp/services/mailman/tests/test_xmlrpcrunner.py

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

I Removed some unused/brittle smptd -> mailman test helper code. The code was not used, and we don't want to use it since is was a source of timeouts in tests.

Revision history for this message
Benji York (benji) wrote :

This looks good other than the conflict jetsam starting on line 108 of the diff.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.