From fdc8950fbe2fd8c6499405abd5bcf4f1c9f08d22 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 23 Dec 2020 17:31:10 +0300 Subject: [PATCH] Do not use watchdog when server is run from tty --- programs/server/Server.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index f87b4294587..76765c0374c 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -104,7 +104,12 @@ namespace CurrentMetrics int mainEntryClickHouseServer(int argc, char ** argv) { DB::Server app; - app.shouldSetupWatchdog(argc ? argv[0] : nullptr); + + /// Do not fork separate process from watchdog if we attached to terminal. + /// Otherwise it breaks gdb usage. + if (argc > 0 && !isatty(STDIN_FILENO) && !isatty(STDOUT_FILENO) && !isatty(STDERR_FILENO)) + app.shouldSetupWatchdog(argv[0]); + try { return app.run(argc, argv);