Commit Graph
141 Commits
Author SHA1 Message Date
Nikita FomichevandClaude Sonnet 4.6 3e4c0917a6 ci: fix remaining false-positive ASan/LSan failures in asan_ubsan builds
Two issues remained after the previous fix:

1. The ASan stack-size warning block (4 lines) was only partially
   filtered in `clickhouse_proc.py`. The last line:
     "For details see https://github.com/google/sanitizers/issues/189"
   was not excluded, leaving `sanitizer_hits` non-empty and triggering
   a spurious "Unknown error / Lost connection to server" result for
   jobs that had no real sanitizer errors. Add the missing exclusion.

2. OpenSSL's EVP method cache (`evp_md_new`, `construct_evp_method`,
   `CRYPTO_THREAD_lock_new`) is never freed at process exit. These
   objects are allocated when the S3 client initializes HMAC via
   `AWS SDK -> HMAC_Init_ex -> EVP_MD_fetch`. LSan reports them as
   leaks, causing the server to abort with SIGABRT (`halt_on_error=1`),
   which `clickhouse-test` records as "Unknown error / Lost connection
   to server". Add suppressions to `__lsan_default_suppressions`.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
2026-03-18 09:37:08 +01:00
Alexey MilovidovandGitHub 9dc67f0844 Merge branch 'master' into nik/asan-ubsan-combined 2026-03-17 22:25:47 -04:00
Nikita FomichevandClaude Sonnet 4.6 44d1fee8d3 ci: suppress OpenSSL false-positive LSan leaks in ASan builds
`clickhouse local` (used for post-test log collection) was aborting at
exit under ASan+LSan with 45 KB of leaks from OpenSSL provider
initialization (`ossl_provider_new`, `OSSL_PROVIDER_try_load_ex`, etc.).
OpenSSL 3.x intentionally does not free all global state at exit, so
these are false positives.

Added `__lsan_default_suppressions` alongside the existing
`__lsan_default_options` in `programs/main.cpp` to suppress the five
known OpenSSL leak patterns. This fixes the "Unknown error / Lost
connection to server" failures in:
  - Stateless tests (amd_asan_ubsan, distributed plan, parallel, 1/2)
  - Stateless tests (amd_asan_ubsan, distributed plan, parallel, 2/2)
  - Stateless tests (arm_asan_ubsan, azure, sequential)

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99657&sha=24b9445c3f9c8dfc420b55f1a2fb369ae17220be&name_0=PR

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
2026-03-17 21:32:18 +01:00
Azat KhuzhinandClaude c6e3ef6a00 Integrate jemalloc with je_ prefix and remove usage of linker's --wrap
Simplify jemalloc integration by replacing the three-mechanism approach
(`JEMALLOC_IS_MALLOC` + `JEMALLOC_OVERRIDE___LIBC_*` + linker `--wrap`)
with a cleaner two-step design:

1. Compile jemalloc with `je_` prefix so it only exports `je_malloc`,
   `je_free`, etc. (matching what Darwin already does).

2. Define our own `malloc`/`free` in `malloc.cpp` that perform memory
   tracking and delegate to `je_malloc`/`je_free`. Provide `__libc_*`
   aliases on glibc to intercept internal calls.

Changes:
- Enable `JEMALLOC_PREFIX "je_"` in all non-Darwin `jemalloc_internal_defs.h.in`
- Undef `JEMALLOC_IS_MALLOC` and all `JEMALLOC_OVERRIDE___LIBC_*` defines
- Remove `JEMALLOC_OVERRIDE_MEMALIGN`/`VALLOC`/`PVALLOC` from `jemalloc_defs.h`
- Add `JEMALLOC_NO_RENAME` interface define so consumer code sees `je_*` names
- Prefix all jemalloc API calls (`mallctl` -> `je_mallctl`, etc.) in ClickHouse
- Rewrite `memory.h` to call `je_malloc`/`je_free` directly instead of `__real_*`
- Rewrite `malloc.cpp` with tracking wrappers calling `je_*` underneath
- Rewrite `AllocationInterceptors.h` to map `__real_*` -> `je_*` or `::*`
- Remove `__wrap_*` functions from `AllocationInterceptors.cpp`
- Remove `--wrap` linker flags from `CMakeLists.txt`
- Add jemalloc + clickhouse_common_io deps to `clickhouse_malloc` OBJECT library
- And also fix JEMALLOC_CPREFIX for Darwin, that was the only platform that uses JE_MALLOC_CONF (over MALLOC_CONF)

Co-Authored-By: Claude <[email protected]>
2026-03-13 10:49:11 +01:00
Alexey MilovidovandClaude Opus 4.6 7903c912f8 Fix build: use of undeclared identifier printHelpOnError
Commit 66aeef7f59 introduced a reference to `printHelpOnError` which
doesn't exist — the function is called `printHelp`. This caused a
build failure.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-27 01:43:27 +01:00
Alexey MilovidovandGitHub 3e0d079016 Merge pull request #98038 from ClickHouse/revert-96025-clickhouse-help
Revert "Improve help output for ClickHouse applications"
2026-02-27 00:48:53 +01:00
Raúl MarínandClaude Opus 4.6 66aeef7f59 Improve error message when passing a non-existent file to clickhouse
When running `clickhouse path/to/nonexistent.sql` or
`clickhouse local /tmp/aaa.rep`, the error messages were confusing:
the main binary showed the generic "Use one of the following commands"
help, and `clickhouse-local` showed "Positional option is not supported".

Now, if the argument looks like a file path (contains `/` or `.`) but
the file doesn't exist, a clear "no such file" error is shown instead.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-26 11:15:28 +01:00
Alexey MilovidovandGitHub e8654c51eb Revert "Improve help output for ClickHouse applications" 2026-02-26 07:51:17 +01:00
Alexey MilovidovandClaude Opus 4.5 62ccfbd3aa Improve help output for ClickHouse applications
This commit improves the help output for all ClickHouse applications:

- Add `clickhouse help` command that lists all available subcommands
- Return exit code 0 for all help messages (previously some returned 1)
- Output help messages to stdout instead of stderr
- Use "clickhouse <cmd>" format instead of argv[0] in help messages
- Add dynamic `app_name` detection for `clickhouse client` and `clickhouse local`
  to show correct invocation name based on how the binary was called
- Add `--no-sudo` option for `clickhouse start` and `clickhouse restart`
  for environments without sudo (e.g., Docker containers)
- Add detailed help headers and footers for client and local with usage examples

Closes #58244

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-02-05 07:12:44 +01:00
Robert Schulze 1a94f68d74 Remove Gin index implementation 2025-09-17 22:04:35 +00:00
Azat Khuzhin 83d2266271 Dynamic memory_limit_mb for TSan (should fix OOMs for TSan stateless jobs)
Otherwise after using different type of instances (in particular VMs
with 32GiB of RAM for sequential stateless runs), clickhouse-server may
got KILLed by OOM killer [1], and it should be TSan internal memory.

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=85698&sha=528856cc8dba02ab2b6ecb7024ac6e23b0e4fc8a&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20sequential%2C%201%2F2%29
2025-08-18 15:31:55 +02:00
Konstantin Bogdanov 260122b0a0 Improve error message for functions unavailable in FIPS mode 2025-08-06 03:52:46 +02:00
Azat Khuzhin 44542fc967 Use __*san_default_options() over *SAN_OPTIONS env vars 2025-07-27 19:19:37 +02:00
Robert Schulze 2e57b6afaa Merge remote-tracking branch 'ClickHouse/master' into ahmadov/fst-dump-tree 2025-06-30 18:06:33 +00:00
Elmi Ahmadov 17a161dddd Add README and include more information in output 2025-06-30 16:51:17 +02:00
Elmi Ahmadov 5269d47e92 Add new tool to inspect and dump the FST index tree
The new tool can inspect the number of states and dump the FST tree in a
dotgraph representation.
2025-06-26 14:04:12 +00:00
Alexey Milovidov 28c73e3c44 Allow writing ch dig 2025-06-25 02:57:47 +02:00
Azat Khuzhin b2b4040023 Bundle chdig into clickhouse binary
Previously it was only shipped as part of the client package, now it
will be bundled into the binary, and will be available as:
- clickhouse chdig
- clickhouse-chdig
- chdig

Note, that since now chdig will not be linked, we can remove all
quirks for this, that has been done in #79666
2025-06-23 17:06:25 +02:00
Antonio Andelic 4289db0e4a Add keeper-utils which contains utility tools for Keeper 2025-06-11 20:29:48 +02:00
Alexey Milovidov 7e477ab063 clickhouse/ch aliases can invoke clickhouse-client if connection parameters are specified 2025-06-08 06:03:28 +02:00
Konstantin Bogdanov c850301603 Explicit OpenSSL cleanup in main.cpp 2025-05-19 16:53:47 +02:00
Konstantin Bogdanov c4abcb9542 Lint 2025-04-14 16:47:38 +02:00
Konstantin Bogdanov cd4a3a556d Proper fix 2025-04-14 00:47:15 +02:00
Konstantin Bogdanov 25af85cd7d Fix 2025-04-13 23:35:26 +02:00
Konstantin Bogdanov 66e818caf9 Lint 2025-04-10 21:33:00 +02:00
Konstantin Bogdanov 678acbafdc Fix OpenSSL early init 2025-04-10 21:33:00 +02:00
Konstantin Bogdanov cc0563e0d8 Hope this fixes msan/tsan 2025-04-10 21:33:00 +02:00
Konstantin Bogdanov 3a9843161e Try fix tests 2025-04-10 21:32:59 +02:00
Raúl Marín 510570386f Continue hiding Exception.h 2025-02-17 18:53:53 +01:00
8ebae42772 Update programs/main.cpp
Co-authored-by: Alexander Gololobov <[email protected]>
2025-02-03 17:44:16 +01:00
Antonio Andelic a34e7815bb Ignore some jemalloc messages 2025-02-03 16:22:48 +01:00
Nikita Mikhaylov 9c094a9959 Fixed FreeBSD build 2024-12-09 21:35:31 +00:00
Nikita Mikhaylov 5514403584 Better CMake 2024-12-09 21:35:31 +00:00
Nikita Mikhaylov 6024e34bef Return order to clickhouse-applications 2024-12-09 21:35:31 +00:00
Nikita Mikhaylov ec5830c857 Fix fasttest 2024-12-09 21:35:31 +00:00
Nikita Mikhaylov dc7bc42223 Moved some of utils to programs 2024-12-09 21:35:31 +00:00
Raúl Marín e50265bae5 Optimize includes of Exception.h 2024-12-02 22:26:41 +01:00
Raúl Marín 4fb38411c1 Only accept regular files 2024-11-07 19:06:36 +01:00
Raúl Marín 07b480c1e4 Implicitly treat a file argument as --queries-file 2024-11-07 14:44:31 +01:00
Antonio Andelic 5875694669 Fix includes 2024-07-03 18:48:32 +02:00
Antonio Andelic 07f51e02ed Reuse some checks 2024-07-03 16:54:09 +02:00
Alexey Milovidov 54c0bdee09 Fix style 2024-06-21 16:00:20 +02:00
Alexey Milovidov 5c541af995 Do not print jemalloc message at startup 2024-06-21 15:15:13 +02:00
Robert Schulze 18d432f44c Reapply "Remove some unnecessary UNREACHABLEs"
This reverts commit 5a868304c0.
2024-05-29 13:37:47 +00:00
Alexander TokmakovandGitHub 5a868304c0 Revert "Remove some unnecessary UNREACHABLEs" 2024-05-27 11:38:22 +02:00
Robert Schulze 0d3aeddc93 Merge remote-tracking branch 'rschu1ze/master' into unreachable-unreachable 2024-05-22 07:25:00 +00:00
Robert Schulze 2909e6451b Move StringUtils.h/cpp back to Common/ 2024-05-19 09:39:36 +00:00
Robert Schulze 53e992af4f Remove some unnecessary UNREACHABLEs 2024-05-17 11:46:07 +00:00
Alexey Milovidov 95f12ef274 Useless changes 2024-05-09 01:08:33 +02:00
Alexey Milovidov d7d38b14e8 Fix tests 2024-04-30 04:21:44 +02:00