Skip to content

Add the InteractiveUtils.diagnostics() and InteractiveUtils.stdlib_diagnostics() functions #43834

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

DilumAluthge
Copy link
Member

@DilumAluthge DilumAluthge commented Jan 17, 2022

This PR is an attempt to create an "all-in-one" debugging function that dumps as much debugging information as possible. That way, when a user opens a new bug report, instead of needing to run ten or twenty different commands, they can just run a single command (InteractiveUtils.diagnostics()) and post the output of that command (after confirming that the output does not contain any information that should not be shared publicly).

Sorry, something went wrong.

@DilumAluthge
Copy link
Member Author

DilumAluthge commented Jan 17, 2022

A while ago on Slack, @GunnarFarneback suggested having a Pkg.diagnostics() function that would print out the following information:

  • What package server is configured (if any)
  • Whether the package server is operational
  • If it's not, why, to the extent it can be determined. (Proxy error, server down, bad host name, whatever.)
  • What kind of registry is being used (git, unpacked from package server, compressed tar)
  • Possibly detecting known registry failure modes (git registry dirty, unpacked registry incomplete)
  • What environment variables influencing Pkg behavior are set

I think that it might be good to add that information to the InteractiveUtils.diagnostics() function in this PR, instead of creating a new Pkg-specific Pkg.diagnostics() function. That way, the user experience is easier; the user just needs to run a single function InteractiveUtils.diagnostics() and post its output (after confirming that the output does not contain any information that should not be shared publicly).

Sorry, something went wrong.

@DilumAluthge DilumAluthge force-pushed the dpa/diagnostics-interactiveutils branch 3 times, most recently from acafe8c to 8b6737c Compare January 17, 2022 07:53
@DilumAluthge DilumAluthge added the stdlib Julia's standard library label Jan 17, 2022
@vtjnash
Copy link
Member

vtjnash commented Feb 9, 2022

This seems like a good idea to me. I wonder if we could do this as a hook-type system, so that this function is just a little stub which is implemented as:

function diagnostics(io=stdout)
    println(io, "# header info:")
    println(io, " ?")
    for m in sort!(Base.loaded_modules_array(), by=nameof)
        if isdefined(m, :__diagnostics__) && applicable(m.__diagnostics__, io)
            println(io, "# " nameof(m))
            println(io, "-"^length(String(nameof(m)))
            m.__diagnostics__(io)
            println()
        end
    end
    println(io, "# footer info")
    println(io, " ?")
end

@DilumAluthge DilumAluthge force-pushed the dpa/diagnostics-interactiveutils branch 2 times, most recently from b058cd0 to 76ac73b Compare February 16, 2022 03:07
@DilumAluthge DilumAluthge force-pushed the dpa/diagnostics-interactiveutils branch from 36179c2 to e5bcd30 Compare February 16, 2022 04:12
@DilumAluthge DilumAluthge changed the title [WIP] Add the InteractiveUtils.diagnostics() function [WIP] Add the InteractiveUtils.diagnostics() and InteractiveUtils.stdlib_diagnostics() functions Feb 16, 2022
@DilumAluthge DilumAluthge force-pushed the dpa/diagnostics-interactiveutils branch from deef130 to 45416e7 Compare February 16, 2022 04:59
@DilumAluthge DilumAluthge changed the title [WIP] Add the InteractiveUtils.diagnostics() and InteractiveUtils.stdlib_diagnostics() functions Add the InteractiveUtils.diagnostics() and InteractiveUtils.stdlib_diagnostics() functions Feb 16, 2022
@DilumAluthge DilumAluthge marked this pull request as ready for review February 16, 2022 05:00
@DilumAluthge
Copy link
Member Author

I like the idea of the hook-type system. I've implemented that approach here. I've also made a few PRs to external stdlibs to add __diagnostics__ functions to those stdlibs:

  1. Add the NetworkOptions.__diagnostics__() function NetworkOptions.jl#21
  2. Add the Pkg.__diagnostics__() function Pkg.jl#2992

@DilumAluthge DilumAluthge requested a review from vtjnash February 16, 2022 05:01

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Comment on lines +39 to +40
Base.showerror(io, ex)
Base.show_backtrace(io, bt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Base.showerror(io, ex)
Base.show_backtrace(io, bt)
Base.showerror(io, catch_stack())

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per https://docs.julialang.org/en/v1.8-dev/base/base/#Base.current_exceptions, it looks like catch_stack() has been renamed in 1.7 and later?

@vtjnash vtjnash added the triage This should be discussed on a triage call label Feb 16, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@JeffBezanson
Copy link
Member

JeffBezanson commented Feb 17, 2022

Seems ok to me. Request from @StefanKarpinski : return a TOML-compatible data structure that prints nicely, so it can be processed programmatically. versioninfo can be migrated to that as well; where necessary the value for a key can just be a big string to make it easier. Specifically: __diagnostics__ can return Dicts, diagnostics can call TOML to print it nicely.

@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Julia's standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants