Skip to content

TOOLS-4148 Add tests for SIGPIPE handling, remove equivalent JS tests, and fix handling for other signals#956

Open
autarch wants to merge 1 commit intomasterfrom
03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe
Open

TOOLS-4148 Add tests for SIGPIPE handling, remove equivalent JS tests, and fix handling for other signals#956
autarch wants to merge 1 commit intomasterfrom
03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe

Conversation

@autarch
Copy link
Collaborator

@autarch autarch commented Mar 25, 2026

This test makes sure that we ignore SIGPIPE. Instead, writes to a broken pipe will cause the write call to return an error. The tools should always check errors on write calls, so these will be surfaced as normal "failure to write to an fd" errors, as opposed to the signal aborting the process.

This also fixes a bug in our handling of other channels that the AI found. In Go, we should always use a buffered channel for signal handling, or we can miss the signal entirely. See https://pkg.go.dev/os/signal for more on this.

This was referenced Mar 25, 2026
Copy link
Collaborator Author

autarch commented Mar 25, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from 505e342 to 0d86363 Compare March 25, 2026 16:52
@autarch autarch changed the title Add a new test for our SIGPIPE handling in the common code Add a new test for our SIGPIPE handling in the common code and remove JS tests for broken pipe handling Mar 25, 2026
@autarch autarch changed the title Add a new test for our SIGPIPE handling in the common code and remove JS tests for broken pipe handling Add a test for SIGPIPE handling in common, remove JS tests for broken pipe handling, and fix handling for other signals Mar 25, 2026
@autarch autarch changed the base branch from 03-18-migration_annotate_js_tests_with_verified_go_coverage_triage to graphite-base/956 March 25, 2026 16:59
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from 0d86363 to 92b91bd Compare March 25, 2026 16:59
@autarch autarch force-pushed the graphite-base/956 branch from 17ad8a1 to 1085693 Compare March 25, 2026 16:59
@autarch autarch changed the base branch from graphite-base/956 to 03-13-add_a_new_sharded_test_type_for_sharded_cluster_integration_tests March 25, 2026 16:59
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch 2 times, most recently from 646a13b to a8eb9e7 Compare March 25, 2026 17:15
@autarch autarch force-pushed the 03-13-add_a_new_sharded_test_type_for_sharded_cluster_integration_tests branch from 1085693 to 766992b Compare March 25, 2026 17:15
@autarch autarch requested a review from FGasper March 25, 2026 20:32
@autarch autarch marked this pull request as ready for review March 25, 2026 20:32
@autarch autarch requested a review from a team as a code owner March 25, 2026 20:32
@autarch autarch force-pushed the 03-13-add_a_new_sharded_test_type_for_sharded_cluster_integration_tests branch from 766992b to aede66b Compare March 25, 2026 20:47
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from a8eb9e7 to 0fa5fbe Compare March 25, 2026 20:48
@autarch autarch changed the base branch from 03-13-add_a_new_sharded_test_type_for_sharded_cluster_integration_tests to graphite-base/956 March 26, 2026 00:39
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from 0fa5fbe to de973e6 Compare March 26, 2026 01:11
@autarch autarch force-pushed the graphite-base/956 branch from aede66b to 48c54ef Compare March 26, 2026 01:11
@graphite-app graphite-app bot changed the base branch from graphite-base/956 to master March 26, 2026 01:11
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from de973e6 to d93b762 Compare March 26, 2026 01:12
Copy link
Collaborator

@FGasper FGasper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This replaces end-to-end tests of the actual applications with a unit test of a specific function. It’s useful but doesn’t retain the original test’s scope.

How feasible is it to build the application, pipe its stdout to a process that ends right away, and verify that the application exits nonzero but doesn’t die from SIGPIPE? (Probably also keep the check for the string broken pipe.)

@autarch autarch changed the title Add a test for SIGPIPE handling in common, remove JS tests for broken pipe handling, and fix handling for other signals TOOLS-4148 Add tests for SIGPIPE handling, remove equivalent JS tests, and fix handling for other signals Mar 26, 2026
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from d93b762 to dc868fb Compare March 26, 2026 16:41
Copy link
Collaborator Author

autarch commented Mar 26, 2026

I added end to end tests for bsondump, mongodump, and mongoexport.

@autarch autarch requested a review from FGasper March 26, 2026 16:42
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from dc868fb to a7a8c12 Compare March 26, 2026 16:53
This test makes sure that we ignore SIGPIPE. Instead, writes to a broken pipe will cause the write call to return an error. The tools should always check errors on write calls, so these will be surfaced as normal "failure to write to an fd" errors, as opposed to the signal aborting the process.
@autarch autarch force-pushed the 03-25-add_a_new_test_in_common_for_our_handling_of_sigpipe branch from a7a8c12 to 8887a8d Compare March 26, 2026 21:36
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.

2 participants