Skip to content

dmypy status reports as "stuck" when it's busy checking files #18008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Redoubts opened this issue Oct 21, 2024 · 1 comment · Fixed by #18331
Closed

dmypy status reports as "stuck" when it's busy checking files #18008

Redoubts opened this issue Oct 21, 2024 · 1 comment · Fixed by #18331
Labels
bug mypy got something wrong topic-daemon dmypy

Comments

@Redoubts
Copy link

I wanna use dmypy to help with checking my large company codebase. I've noticed on first check, or when checking a large number of files it will take a few dozen seconds to return (expected for my large repo). However, when I do dmypy status on it during this time, I see

error                   :  timed out
Daemon is stuck; consider /usr/scratch/pthompson/junk/ops3venv11/bin/dmypy kill

I don't think this is correct. It's not "stuck", it's just busy and I'm fairly confident it will return an answer eventually. But I think this means dmypy run will attempt to start another daemon during this time (if I spam it with a for loop I can get into a funky state); and it might be harder to build tooling around a check/start/stop flow. Is there a way to get a better status than this?

@Redoubts Redoubts added the bug mypy got something wrong label Oct 21, 2024
@svalentin svalentin added the topic-daemon dmypy label Oct 23, 2024
@WnRock
Copy link
Contributor

WnRock commented Dec 21, 2024

I find the following code:

# mypy/dmypy/client.py

@action(status_parser)
def do_status(args: argparse.Namespace) -> None:
    ...
    response = request(
        args.status_file, "status", fswatcher_dump_file=args.fswatcher_dump_file, timeout=5
    )
    if args.verbose or "error" in response:
        show_stats(response)
    if "error" in response:
        fail(f"Daemon is stuck; consider {sys.argv[0]} kill")
    ...

It seems the current implementation sets a 5-second timeout for IPC communication to dmypy server, which is why you're seeing the "stuck" message. This timeout is intended to detect genuinely unresponsive states, but as you've observed, it doesn't account for scenarios where the daemon is just busy.

WnRock added a commit to WnRock/mypy that referenced this issue Dec 23, 2024
Update the status message to clarify that the daemon may be busy and not necessarily stuck. The new message provides better guidance to users without prematurely suggesting killing the daemon.

Fixes python#18008
hauntsaninja pushed a commit that referenced this issue Dec 25, 2024
Revised the status message output from the `dmypy status` command to
eliminate potential misunderstandings about the daemon's operational
state.

Given the daemon’s synchronous design, the server may appear
unresponsive during periods of heavy processing. When encountering a
timeout, the status message could suggest that the daemon was "stuck",
prompting users to prematurely consider stopping it.

Fixes #18008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-daemon dmypy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants