Skip to content

Conversation

@Fluxie
Copy link

@Fluxie Fluxie commented Jan 24, 2024

I'm adding support to proxide proxy for capturing the stack traces of the client process that makes requests through the proxy when the client process and the proxide proxy reside on the same host. I have already implemented a preliminary support here: Rantanen/proxide#36.

However, the current approach is a bit inefficient as it always captures the stack traces of all the threads of the client process even though only the stack trace of the thread associated with the request being proxy-ed is enough. Thus I want to add support for capturing stack traces of individual threads at a time to rstack.

To do this, I wanted to start this by adding support for unit testing as I like to execute code during development time with unit tests. => This merge request.

My current plan for adding the support for capturing individual threads is to create a struct call ProcessAttachment which would have a method for capturing stack traces of individual threads. The ProcessAttachment struct would be created by calling a new method called "attach" which would be added to the TraceOptions struct.

Does this plan/idea sound reasonable to you?

In addition to the actual unit test for the rstack library this commit also introduces a dummy child process called "capture-target" as a capture target for the unit tests.

 The lifecycle of the process is encapsulated with a helper library called "target-launcher" which starts and stops the capture target process when requested. The launcher gives out the process id of the capture target that can be then used to trace the capture target process.
@Fluxie Fluxie changed the title Added a simple unit test for process stack trace capture Added a simple unit test for testing process stack trace capture Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant