Closed Bug 1532557 Opened 5 years ago Closed 5 years ago

[mozproxy] Improve mitmdump start/stop process

Categories

(Testing :: Mozbase, enhancement)

Version 3
enhancement
Not set
normal

Tracking

(firefox68 fixed)

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: tarek, Assigned: tarek)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Instead of the 10s sleep we currently have, followed by a poll, a better way to verify that mitmdump is up and running is to try to connect to it via TCP.

This will speed up the start time and avoid a case where the process is started but the proxy is not really working.

e.g.

import socket

def check_proxy(host='localhost', port=8080):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        s.connect((host, port))
        s.shutdown(socket.SHUT_RDWR)
        s.close()
        return True
    except socket.error:
        return False
Depends on: 1528992

This patch will remove the very long wait on start and stop,
should be down to one second.

Blocks: 1527620
Attachment #9051276 - Attachment description: Bug 1532557 - Improve mitmdump start/stop process - r?rwood → Bug 1532557 - Improve mitmdump start/stop process - r?rwood,whimboo
Blocks: 1536027

This looks to be a generic mozbase package now. Moving to the correct component.

Status: NEW → ASSIGNED
Component: Raptor → Mozbase
Summary: Improve mitmdump start/stop process → [mozproxy] Improve mitmdump start/stop process
Attachment #9051276 - Attachment description: Bug 1532557 - Improve mitmdump start/stop process - r?rwood,whimboo → Bug 1532557 - Improve mitmdump start/stop process - r?whimboo
Pushed by tziade@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2811220eaad7
Improve mitmdump start/stop process - r=whimboo
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68

This looks to be causing a regression for me when running locally:
I now see this error:

16:50:19     INFO -  mozproxy Starting mitmproxy playback using command: /Users/acreskey/dev/src/build/obj-release/testing/mozproxy/mitmdump -k -s ""/Users/acreskey/dev/src/mozilla-central/testing/raptor/raptor/playback/alternate-server-replay.py /Users/acreskey/dev/src/build/obj-release/testing/mozproxy/amazon.mp""
16:50:20     INFO -  mozproxy Aborting: mitmproxy playback process failed to work
16:50:20     INFO -  mozproxy Stopping mitmproxy playback, killing process 1852
16:50:20     INFO -  mozproxy Mitmproxy exited with error code -15

But if I run the given playback command from the terminal, mitmproxy starts up:

~/dev/src/mozilla-central$ /Users/acreskey/dev/src/build/obj-release/testing/mozproxy/mitmdump -k -s ""/Users/acreskey/dev/src/mozilla-central/testing/raptor/raptor/playback/alternate-server-replay.py /Users/acreskey/dev/src/build/obj-release/testg/mozproxy/amazon.mp""
Loading script: /Users/acreskey/dev/src/mozilla-central/testing/raptor/raptor/playback/alternate-server-replay.py
Replaying from files: []
Proxy server listening at http://0.0.0.0:8080

I'm on a MacbookPro. I did make sure that there was no other instance of mitmdump running.

The info why it is failing to start-up is pretty unclear. Do we have a chance to get mozprocess to give some more information which could be added to this log entry? I would suggest filing a new bug for that improvement/fix.

Flags: needinfo?(tarek)

Note, that I'm also seeing this problem. I filed bug 1538677 to get this fixed/improved.

Flags: needinfo?(tarek)
No longer depends on: 1538677
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: