-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add a command line flag to create an rr recording #35494
Conversation
Presumably this only works on Linux? |
Yes, rr only works on Linux. That said, I intend the |
How about calling the option |
Or better still, no short option. |
That's what I did at first, but currently to pass to julia it needs to have a short option or it gets angry at you ;). I agree, I was lazy, I'll fix it. |
So the idea was to style it as |
I think |
Ok, will change. |
How do you pass options to rr (e.g. --chaos, --num-cores)? |
I don't really want to add an option for that to the julia command line, but I think |
Sounds good to me. Maybe |
Yes! The consistent prefix is |
-- staticfloat I also realized a few days ago that my AVX-512 machine can't run ivybridge/sandybridge code (I can't start Julia with |
You'd need to change the feature set of your CPU at runtime to match the lowest common denominator of what you want to record/replay on. Luckily for the moment, we have some very new machines that have all the features. It does need a kernel patch to work though. For more information, see: https://lkml.org/lkml/2018/6/16/134 |
Should we auto-install the |
@StefanKarpinski do you have an opinion on whether it would be ok to automatically install the package if it isn't available yet? |
+1 for installing BugReporting.jl in an isolated temporary environment. It's conceivable that some bugs manifest in particular versions of packages (e.g., JSON.jl) that are incompatible with BugReporting.jl. It'd be nice to be able to confidently use Also, it doesn't have to be temporary, does it? Why not use |
Maybe check if it already exists in the current load path and if not, create a temporary environment, put it at the front of the load path, add BugReporting in it and use it, then when done, delete the environment. Deleting and recreating should be no big deal since the environment is just a directory with a project and manifest in it, the actual installed copy of the package will stay around until it's garbage collected. Why check for BugReporting in the current load path first? Because otherwise it's impossible for the user to explicitly control what version of BugReporting to use, which might sometimes be desirable. |
Now with auto-installation as suggested by @StefanKarpinski (should work as soon as the package is registered). BTW, I'd appreciate if people try out the workflow in the meantime and give feedback. |
Unless there's further comments, I'll plan to merge this once the package registration goes through. |
return mktempdir() do tmp | ||
prev_active = Base.ACTIVE_PROJECT[] | ||
env_path = joinpath(tmp, "TmpForBugReporting") | ||
Pkg.generate(env_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you generate a package here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just delete it from here.
let Pkg = Base.require(Base.PkgId( | ||
Base.UUID((0x44cfe95a_1eb2_52ea,0xb672_e2afdf69b78f)), "Pkg")) | ||
return mktempdir() do tmp | ||
prev_active = Base.ACTIVE_PROJECT[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to handle the case where @
is not in the load path you need something like
old_load_path = copy(LOAD_PATH)
push!(empty!(LOAD_PATH), tmp)
Pkg.add(...)
BugReporting = Base.require(...)
append!(empty!(LOAD_PATH), old_load_path)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it still need at least some project?
Without that
ERROR: no active project
Stacktrace:
[1] pkgerror(::String) at /home/keno/julia-rebase/usr/share/julia/stdlib/v1.5/Pkg/src/Types.jl:52
[2] find_project_file(::Nothing) at /home/keno/julia-rebase/usr/share/julia/stdlib/v1.5/Pkg/src/Types.jl:180
I'm happy to do whatever the recommended thing here, is, but I think I'll go ahead and merge as is, since it seems to work ok. Would appreciate a PR to do it the proper way :)
Recently I've been asking people to send me rr recordings whenever they encounter bugs, since it really streamlines the bug fixing process (in particular, it cuts out the whole "get it to reproduce and capture it in rr part of the process"). However, the process so far is not quite trivial. You have to get rr from somewhere (in a version that isn't broken for latest julia), you have to remember to pack it and then you have to find a place to upload it. I put together a package (https://github.com/Keno/BugReporting.jl) that takes care of all of these steps, but the convenience isn't quite 100% yet. That's what this PR is supposed to address. It adds `--bug=` command line flag that internally loads up the BugReporting, but passes through all the command line options, environment, etc. The idea is that to create a bug report you just do all the things you usually do, but instead of launching `julia`, you launch `julia --bug`. This should also work if you are launching Julia from within a script, etc. Demo: https://asciinema.org/a/JFdoGT2wlxBE7uyzM1ZjwgSA5
Tried to use it for #35014:
Perhaps it doesn't like the |
Error might be because |
Now I tried to run it for #35580 but got:
|
Whoops, we of course need to ignorestatus the rr code, so it doesn't interrupt julia. The good news is that your recording should be stored, and you should be able to manually pass the directory it printed at the beginning to |
It printed
but there is no such folder / file. |
It most likely got cleaned up by the |
Recently I've been asking people to send me rr recordings whenever
they encounter bugs, since it really streamlines the bug fixing process
(in particular, it cuts out the whole "get it to reproduce and capture
it in rr" part of the process). However, the process so far is not quite
trivial. You have to get rr from somewhere (in a version that isn't broken
for latest julia), you have to remember to pack it and then you have
to find a place to upload it. I put together a package
(https://github.com/JuliaLang/BugReporting.jl [1]) that takes care of all of these
steps, but the convenience isn't quite 100% yet. That's what this PR is
supposed to address. It adds
--bug=
command line flag that internallyloads up the BugReporting, but passes through all the command line
options, environment, etc. The idea is that to create a bug report
you just do all the things you usually do, but instead of launching
julia
, you launchjulia --bug
. This should also work if you arelaunching Julia from within a script, etc.
Demo: https://asciinema.org/a/JFdoGT2wlxBE7uyzM1ZjwgSA5
[1] Note: Not yet registered, I'm waiting for a few dependency bumps to go through.