Skip to content

running hook is triggered too early, before "address already in use" exit #5376

Closed

Description

@Prinzhorn

Problem Description

Docs say

Called when the proxy is completely up and running

In reality running is triggered despite the port not being available.

For me this causes a flickering in the UI because I use running to tell the parent process that the proxy is ready. But shortly after that the process exits and I'm back in the stopped state. So the UI will be in the "Proxy is up" state for like 200ms which looks ugli and buggy.

In v7 we didn't properly exit at all when the port was available and it v6 the running hook is not called.

Steps to reproduce the behavior:

  1. ncat -l 8080 make the port unavaiable
  2. mitmdump --quiet --scripts addon.py
def running():
    print("running")

You get the following output

running
[Errno 98] error while attempting to bind on address ('0.0.0.0', 8080): address already in use

System Information

I downloaded the 8.1.0 because I currently can't run mitmproxy locally (still on Ubuntu 20.04 with Python 3.8) and can't remember how to download the main snapshots.

Mitmproxy: 8.1.0 binary
Python:    3.10.4
OpenSSL:   OpenSSL 3.0.3 3 May 2022
Platform:  Linux-5.13.0-44-generic-x86_64-with-glibc2.31

Activity

  1. added
    kind/triage
    on May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions