-
-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
task sync crashes with SIGPIPE #3624
Comments
Hm, I just get
can you give more steps to reproduce, or better yet an strace of where the SIGPIPE occurs? Also, can you please show how you're running |
It was hard to create a simple reproducer, but this should work:
And this is the stack trace:
|
Thanks! I can reproduce with that result! I filed algesten/ureq#819 to see if there's a good way to handle this, as a bit of searching didn't find any suggestions. |
They would like a simple reproduction with ureq alone. I won't get a chance to work on that for a bit, if anyone else wants to try. |
I built a little test script in the |
diff --git src/main.cpp src/main.cpp
index cbdeb0994..3d4a3d1b1 100644
--- src/main.cpp
+++ src/main.cpp
@@ -24,25 +24,36 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
// cmake.h include header must come first
#include <Context.h>
#include <rust/cxx.h>
+#include <signal.h>
#include <cstring>
#include <iostream>
#include <new>
#include <regex>
////////////////////////////////////////////////////////////////////////////////
int main(int argc, const char** argv) {
int status{0};
+ struct sigaction sa;
+
+ // Initialize the signal action structure
+ sa.sa_handler = SIG_IGN; // Set the handler to ignore SIGPIPE
+ sa.sa_flags = 0;
+
+ // Set the signal handler for SIGPIPE
+ if (sigaction(SIGPIPE, &sa, NULL) == -1) {
+ return 1;
+ }
Context globalContext;
Context::setContext(&globalContext);
// Lightweight version checking that doesn't require initialization or any I/O.
if (argc == 2 && !strcmp(argv[1], "--version")) {
std::cout << VERSION << "\n";
} else { seems to help -- the error message is shown instead of dying on the signal. This matches what the Rust runtime does at startup. I'm not sure that's the right way to set a signal handler, though. |
With somewhat invalid server sync configuration (
sync.server.url
pointing to a service that is not a taskchampion server) runningtask sync
results in the process crashing with unix return code 141 (SIGPIPE), without printing any output to stdout/stderr. I assume the bug is in the external taskwarrior rust lib.task
versoin 3.1.0The text was updated successfully, but these errors were encountered: