Open luker-os opened 1 year ago
two possibilities jump to mind:
If it isn't any of those things then let me know and we can start debugging. :)
@cmyr happens to me too, my application is a Web API, when I kill it after doing 10K requests, I get this error. Could it be that stopping the API doesn't trigger gracefully creating the profiling file?
I think the fix here is for cargo-instruments
to recognise when it's being terminated from the CTRL+C
signal, and to finish writing the traces file. Without that you can't really use it for instrumenting long running processes that don't have a regular shutdown like a web server.
The problem is that we aren't responsible for writing traces; that's up to xctrace
, and so we have no control over what it does in response to SIGINT
.
The only thing cargo-instruments can offer here is the --time-limit
command, which lets you specify a number of seconds to run the app before termination.
If you want to attach to a running application, profile it, and then stop profiling, you'll need to dig into the xctrace
command line utility (or just Instruments.app
)
The problem is that we aren't responsible for writing traces; that's up to xctrace, and so we have no control over what it does in response to SIGINT.
Right but you're the parent process, that's responsible for running both the app and xctrace. You could spawn those into different process groups, and then when cargo-instruments
get a SIGINT
, you forward that to the app to terminate it, but not to the xctrace process. Letting it finish writing traces before you finish.
That's an interesting idea, but we don't actually spawn the target process, we just invoke xctrace
with the --launch
option, and it executes the target. We could change this in theory and do the launching ourselves before attaching xctrace
but that's a fairly significant change that I don't really have the appetite for at the moment.
I am trying to run cargo-instruments via:
When I do, everything seems to run:
and I see a new
.trace
file generated in./target/instruments
, but if I try to open the file, Instruments fails with the error:I'm using: Instruments: Version 14.3.1 (14E300c) cargo-instruments: 0.4.8 rustc: 1.70.0
Any ideas what might be going on?
Thanks!