Skip to content

Conversation

joelposti
Copy link

@joelposti joelposti commented Aug 9, 2025

This pull request adds segfault integration test to the tests directory and a test script run-segfault-integration-test-repeatedly.sh that runs said integration test 100 times in a loop. The integration test is used to reproduce a segmentation fault. For the segmentation fault to occur the test usually needs to be run repeatedly.

This pull request relates to the issue #460. The issue describes the segmentation fault in more detail. It also explains the motivation behind creating this pull request.

This pull request is not intended to be merged. It is simply used to demonstrate the segmentation fault and to prove that a fix introduced in another pull request #462 does indeed prevent the segmentation fault. The test code in this pull request can be freely modified and used to create a much more refined regression test.

The integration test makes multiple HTTP requests concurrently to an HTTP server. The client-side code of the test is straightforward enough, but the server-side code is bizarre. The server-side code needs to do all kinds of network I/O, filesystem I/O and thread synchronisation operations to reproduce the conditions in which a panic and the subsequent segmentation fault can occur. In my project, where I originally discovered the issue, I could get the panic to occur pretty easily, but creating an integration test that reproduces the conditions in which the panic occurs was quite difficult. Eventually I just started removing code piece by piece and when the segfault stopped occuring I added the removed code back in more or less altered form.

I hope that the integration test reproduces the panic and the segmentation fault for you.

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