Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/pprof: invokeVisualizer is racy #19020
Thus, the following race occurs in non-interactive mode:
The fix is probably to wait for the visualizer to end regardless of "interactivity".
I noticed that there is already a 1 second wait in the logic I pointed to. I must have been really unlucky and Chrome somehow took longer than 1 second to load up. I'm not sure if there's anything we could do here then. Increasing the wait time seems like a bad idea (how high is high enough?).
Note the logic is to do wait for the visualizer in non-interactive mode. On interactive mode (pprof shell) we do not wait to allow you to let you go back to the command line and spawn other visualizers in parallel.
Having said that, there is a fundamental race condition: we to write the files, run the viewer, wait for the viewer read the files, and then delete them. The problem happens when the visualizer is a command that signals another command (eg chrome), so the visualizer exits even though the files haven't been read.
I could agree with special-casing the delay for some platforms.