8000 24.8.14 Backport of #79147 - Remove guard pages from fibers and alternative stack for signals in threads by mkmkme · Pull Request #2035 · Altinity/ClickHouse · GitHub
[go: up one dir, main page]

Skip to content

24.8.14 Backport of #79147 - Remove guard pages from fibers and alternative stack for signals in threads - #2035

Merged
zvonand merged 4 commits into
customizations/24.8.14from
backports/24.8/79147
Jul 21, 2026
Merged

zvonand merged 4 commits into
customizations/24.8.14from
backports/24.8/79147

Conversation

@mkmkme
@mkmkme mkmkme commented Jul 10, 2026 •
Copy link
Copy Markdown
Collaborator

Note for the reviewer

This PR originally changed two files and I had conflicts in both of them. One of them, FiberStack.cpp, was missing from the original 24.8 branch because it was added later.

Initially I landed the changes on FiberStack.h itself and introduced the missing memoryGuardInstall / memoryGuardRemove functions to Common/memory.h, creating Common/memory.cpp as well. This, however, broke the build for a missing jemalloc.h because FiberStack.h got an include for Common/memory.h:

In file included from /home/mk/git/altinity-clickhouse-24.8-79147/src/Core/ExternalTable.cpp:18:
In file included from /home/mk/git/altinity-clickhouse-24.8-79147/src/Core/ExternalTable.h:3:
In file included from /home/mk/git/altinity-clickhouse-24.8-79147/src/Client/Connection.h:11:
In file included from /home/mk/git/altinity-clickhouse-24.8-79147/src/IO/ReadBufferFromPocoSocketChunked.h:4:
In file included from /home/mk/git/altinity-clickhouse-24.8-79147/src/IO/ReadBufferFromPocoSocket.h:5:
In file included from /home/mk/git/altinity-clickhouse-24.8-79147/src/Common/AsyncTaskExecutor.h:5:
In file included from /home/mk/git/altinity-clickhouse-24.8-79147/src/Common/FiberStack.h:7:
/home/mk/git/altinity-clickhouse-24.8-79147/src/Common/memory.h:13:14: fatal error: 'jemalloc/jemalloc.h' file not found
   13 | #    include <jemalloc/jemalloc.h>
      |              ^~~~~~~~~~~~~~~~~~~~~
1 error generated.

Because of that, I decided to split FiberStack to a header and implementation file as it is in the upstream. When I did that, I got multiple compiler errors about missing fmt and formatReadable* functions because the files using those functions previously got those from transitive includes by FiberStack.h. After I moved most of inclusions to FiberStack.cpp, the functions became undefined.

Before adding the extra includes to Keeper.cpp, ClientBase.cpp, Connection.cpp and AsyncTaskExecutor.cpp I verified those includes existed in the upstream's versions of those files at the moment of the original PR.

Unfortunately all of this led to the situation where the PR got quite large in comparison to the original one.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Remove guard pages for threads and async_socket_for_remote/use_hedge_requests. Change the allocation method in FiberStack from mmap to aligned_alloc. Since this splits VMAs and under heavy load vm.max_map_count can be reached (ClickHouse#79147 by @CheSema)

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

…ack-protection

stack allocation in Fiber and alternative stack for signals
@altinity-robot
altinity-robot commented Jul 10, 2026 •
Copy link
Copy Markdown
Collaborator

This is an automated comment for commit c5b8c57 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Check nameDescriptionStatus
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests❌ failure
Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Grype Scan altinityinfra/clickhouse-keeper:2035-24.8.14.10546.altinitytestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Grype Scan altinityinfra/clickhouse-server:2035-24.8.14.10546.altinitytest-alpineThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Grype Scan altinityinfra/clickhouse-server:2035-24.8.14.10546.altinitytestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Ready for releaseThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 aes_encryptionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 aggregate_functions_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 aggregate_functions_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 aggregate_functions_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 alter_attach_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 alter_attach_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 alter_moveThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 alter_replaceThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 atomic_insertThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 base_58There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 benchmark_aws_s3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 benchmark_gcsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 benchmark_minioThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 clickhouse_keeper_failoverThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 clickhouse_keeper_no_ssl_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 clickhouse_keeper_no_ssl_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 clickhouse_keeper_ssl_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 clickhouse_keeper_ssl_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 data_typesThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 datetime64_extended_rangeThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 disk_level_encryptionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 dnsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 enginesThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 exampleThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 extended_precision_data_typesThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 functionsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 iceberg_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 iceberg_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 jwt_authenticationThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 kafkaThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 kerberosThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 key_valueThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 ldap_authenticationThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 ldap_external_user_directoryThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 ldap_role_mappingThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 lightweight_deleteThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 memoryThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 parquetThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 parquet_aws_s3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 parquet_minioThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 part_moves_between_shardsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 rbac_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 rbac_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 rbac_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_aws_s3_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_aws_s3_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_azure_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_azure_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_export_partThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_export_partitionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_gcs_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_gcs_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_minio_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_minio_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 s3_minio_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 selectsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 session_timezoneThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 settingsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 ssl_server_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 ssl_server_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 ssl_server_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 swarmsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 tiered_storage_localThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 tiered_storage_minioThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 tiered_storage_s3amazonThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 tiered_storage_s3gcsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 versionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression aarch64 window_functionsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release aes_encryptionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release aggregate_functions_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release aggregate_functions_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release aggregate_functions_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release alter_attach_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release alter_attach_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release alter_moveThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release alter_replaceThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release atomic_insertThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release base_58There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release benchmark_aws_s3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release benchmark_gcsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release benchmark_minioThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release clickhouse_keeper_failoverThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release clickhouse_keeper_no_ssl_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release clickhouse_keeper_no_ssl_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release clickhouse_keeper_ssl_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release clickhouse_keeper_ssl_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release data_typesThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release datetime64_extended_rangeThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release disk_level_encryptionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release dnsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release enginesThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release exampleThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release extended_precision_data_typesThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release functionsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release iceberg_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release iceberg_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release jwt_authenticationThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release kafkaThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release kerberosThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release key_valueThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release ldap_authenticationThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release ldap_external_user_directoryThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release ldap_role_mappingThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release lightweight_deleteThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release memoryThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release parquetThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release parquet_aws_s3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release parquet_minioThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release part_moves_between_shardsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release rbac_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release rbac_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release rbac_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_aws_s3_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_aws_s3_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_azure_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_azure_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_export_partThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_export_partitionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_gcs_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_gcs_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_minio_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_minio_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release s3_minio_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release selectsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release session_timezoneThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release settingsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release ssl_server_1There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release ssl_server_2There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release ssl_server_3There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release swarmsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release tiered_storage_localThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release tiered_storage_minioThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release tiered_storage_s3amazonThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release tiered_storage_s3gcsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release versionThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Regression release window_functionsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Sign aarch64There's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Sign releaseThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success

@ilejn
ilejn commented Jul 10, 2026 •
Copy link
Copy Markdown

Honestly I am a bit shocked because I expected something like this https://github.com/Altinity/ClickHouse/tree/backports/24.8.14/79147_tiny
Kind of a sketch, requires minor fixes, but it is compilable.

This is a compact change, it keeps ::munmap and everything that is natural for 24.8

Anyway, the PR looks good to me.

@mkmkme
mkmkme commented Jul 10, 2026
Copy link
Copy Markdown
Collaborator Author

Honestly I am a bit shocked because I expected something like this https://github.com/Altinity/ClickHouse/tree/backports/24.8.14/79147_tiny

This is a compact change, it keeps ::munmap and everything that is natural for 24.8

Anyway, the PR looks good to me.

I was considering that, but wanted to keep it as close to upstream as possible.
We can take your approach instead since you've done it anyway :)

@ilejn
ilejn commented Jul 13, 2026
Copy link
Copy Markdown

I was considering that, but wanted to keep it as close to upstream as possible. We can take your approach instead since you've done it anyway :)

We already have this upstream PR in 25.3 #917
Since this backport is in line with 917, lets go further.

@CarlosFelipeOR
CarlosFelipeOR commented Jul 16, 2026 •
Copy link
Copy Markdown
Collaborator

❌ QA: Build fails — needs a fix before further verification

Verdict: Not approvable in its current state. This PR does not build on either architecture, so no functional or regression testing can run yet.

Build failure

Both BuilderDebRelease (amd64) and BuilderDebAarch64 (arm64) fail identically; everything downstream (stateless, integration, regression, etc.) is SKIPPED as a result.

src/Common/AsyncTaskExecutor.h:126:1: error: unknown type name 'String'; did you mean 'std::string'?
  126 | String getSocketTimeoutExceededMessageByTimeoutType(AsyncEventTimeoutType type, Poco::Timespan timeout, const String & socket_description);

Logs: release · aarch64

Root cause

AsyncTaskExecutor.h uses String (line 126) but obtained it only transitively through FiberStack.h. This PR empties FiberStack.h (moving its includes into the new FiberStack.cpp), so AsyncTaskExecutor.h no longer sees the String alias. The <fmt/format.h> include added to AsyncTaskExecutor.cpp covers the fmt::format usage but not String — and since the declaration lives in the header, the fix belongs in the header.

Suggested fix

// src/Common/AsyncTaskExecutor.h
#include <base/types.h>   // provides the `String` alias (using String = std::string)

This keeps the header self-contained and fixes every consumer in the ExternalTable.h → Connection.h → … → AsyncTaskExecutor.h chain, not just the .cpp.

Backport review (otherwise looks good)

Differential vs upstream ClickHouse#79147: the core logic of FiberStack.cpp and ThreadStatus.cpp matches the upstream final state exactly. The larger diff is justified — it reconstructs prerequisites the 24.8 branch lacked (splitting FiberStack into .h/.cpp, backporting the memoryGuardInstall/memoryGuardRemove infra into memory.cpp).


Root-cause diagnosis and the suggested fix were produced with AI-assisted analysis (static; confirmed by inspecting the header includes, not yet by a local rebuild).

@mkmkme
mkmkme commented Jul 17, 2026
Copy link
Copy Markdown
Collaborator Author

@CarlosFelipeOR,

Thanks! I've addressed this in 26c354c

@CarlosFelipeOR
Copy link
Copy Markdown
Collaborator

✅ QA Verification — Verdict: APPROVED

Faithful backport of ClickHouse#79147 (core logic matches upstream exactly), build fixed, behavioral benefit confirmed (~46% fewer VMAs under fiber load), audit findings are upstream-identical/non-blocking, and all CI failures are pre-existing flaky / known-on-24.8 / infra — zero regressions.

Build blocker from the previous comment is fixed (#include <base/types.h> in AsyncTaskExecutor.h). Details below.

1. Differential vs upstream ClickHouse#79147 ✅

Core logic of FiberStack.cpp and ThreadStatus.cpp matches the upstream merged state exactly. The larger diff is justified — it reconstructs prerequisites the 24.8 branch lacked (split FiberStack into .h/.cpp, backport memoryGuardInstall/memoryGuardRemove into a new memory.cpp, transitive-include fixups). No algorithmic divergence.

2. Behavioral test — VMA reduction (release) ✅

Ran identical load on two release binaries: this PR (guard pages off) vs a no-fix baseline (old mmap+mprotect). Single node, cluster of 3 self-replicas, clickhouse benchmark -c 200 distributed queries with use_hedged_requests=1 + async_socket_for_remote=1. Measured /proc/<pid>/maps:

Metric under identical load This PR Baseline (no fix)
Total VMAs 1997 3722
PROT_NONE (guard) regions 908 1775
fiber/signal-stack guard pages 0 881
fiber stacks as own 320KB VMA 0 30

~46% fewer VMAs under fiber-heavy load — confirms the PR's purpose (avoid hitting vm.max_map_count). No errors/crashes on either binary (~55k queries each). These tests were run locally by the AI model Opus 4.8.

3. Codex AI audit review ✅ (no backport defect)

An AI audit (gpt-5.3-codex) flagged 2 items. Both are verbatim from upstream ClickHouse#79147, not introduced by this backport, and neither is blocking:

  • ThreadStack getSize() adds 1 byte instead of a page (debug/sanitizer only): asserted allocation failure does not occur — non-multiple size is well-defined under C++23 / glibc / jemalloc, and upstream's debug+sanitizer CI is green. Real-but-minor; already refined to += getPageSize() in newer branches (26.x).
  • Asymmetric onAlloc/onFree sampling by one page: the real MemoryTracker stays balanced; only the sample-profiler trace is off by a page. Diagnostic noise, matches upstream.

Optional (non-blocking): consider cherry-picking the later getSize() refinement (+= getPageSize() + page clamp) to keep the alt-stack usable size at its intended minimum.

4. CI triage ✅ (no regressions)

Triaged all failures on the release + sanitizer run (c5b8c57). None are related to this PR, and none touch the changed code area (FiberStack/ThreadStack/memoryGuard/async socket). Notably, the sanitizer builds — where the new guard-page code (memoryGuardInstall/Remove) actually runs — showed no stack/fiber/guard-related failures.

Failure Category Evidence
01903_correct_block_size_prediction_with_default (tsan) Pre-existing flaky Fails on merge run (non-PR) 5× + unrelated PRs #1565/#1655/#1707
AST fuzzer RangeReader read N rows, but M expected (tsan) Pre-existing (fuzzer-found) Also seen on merge run (non-PR); RangeReader/MergeTree area, untouched by PR
test_storage_s3_queue::test_shards_distributed[ordered-8] Pre-existing flaky test_storage_s3_queue is heavily flaky (100s of fails across PRs + merge runs)
Killed by signal (stateless sanitizers) Known pre-existing on 24.8 Present in the last 24.8 release run (2066b289), same asan shard
Job Timeout Expired ×2 (integration release) Infrastructure Job-level timeout, not a test failure

Differential, behavioral test, audit assessment, and CI triage produced with AI-assisted analysis.

@CarlosFelipeOR
Copy link
Copy Markdown
Collaborator

AI audit note: This review comment was generated by AI (gpt-5.3-codex).

Audit update for PR #2035 (guard-page backport in fiber/signal stack allocation):

Confirmed defects:

  • High: ThreadStack guard-page size math breaks alignment contract for aligned_alloc in debug builds
    • Impact: alt signal stack initialization can fail with an exception; stack-overflow diagnostics on sigaltstack become unreliable/unavailable for affected threads.
    • Anchor: src/Common/ThreadStatus.cpp / ThreadStack::getSize -> ThreadStack::ThreadStack -> ThreadStatus::ThreadStatus
    • Trigger: DEBUG_OR_SANITIZER_BUILD path (guardPagesEnabled == true).
    • Why defect: a single byte is added instead of a full page, so allocation size is not page-aligned while passed to aligned_alloc(page_size, size).
    • Code evidence:
    static size_t getSize()
    {
        auto size = std::max<size_t>(UNWIND_MINSIGSTKSZ, MINSIGSTKSZ);

        if constexpr (guardPagesEnabled())
            size += 1;

        return size;
    }
        auto page_size = getPageSize();
        data = aligned_alloc(page_size, getSize());
        if (!data)
            throw ErrnoException(DB::ErrorCodes::CANNOT_ALLOCATE_MEMORY, \"Cannot allocate ThreadStack\");
  • Fix direction (short): add a full guard page (+ getPageSize()) and keep total size page-multiple (also clamp to at least one page).

  • Regression test direction (short): assert alt-stack size invariants under guard-enabled config: size % page_size == 0 and usable size preserves expected minimum.

  • Low: fiber allocation/free sampling reports asymmetric byte counts

    • Impact: memory sample traces can accumulate false positive retained bytes (diagnostic noise in memory profiling).
    • Anchor: src/Common/FiberStack.cpp / FiberStack::allocate, FiberStack::deallocate
    • Trigger: sampled fiber lifecycle.
    • Why defect: alloc sample uses num_bytes, free sample subtracts one page unconditionally.
    • Code evidence:
    auto trace = CurrentMemoryTracker::alloc(num_bytes);
    trace.onAlloc(data, num_bytes);
    /// Do not count guard page in memory usage.
    auto trace = CurrentMemoryTracker::free(sctx.size);
    trace.onFree(data, sctx.size - page_size);
  • Fix direction (short): make sampled alloc/free byte counts symmetric; apply guard-page subtraction only when a guard page was actually reserved/tracked.
  • Regression test direction (short): sampled allocation/free for one fiber lifecycle should net to zero bytes.

Coverage summary:

  • Scope reviewed: all 11 changed files in PR 24.8.14 Backport of #79147 - Remove guard pages from fibers and alternative stack for signals in threads #2035, with deep audit focus on ThreadStatus alt-stack path, FiberStack lifecycle path, and memoryGuardInstall/memoryGuardRemove transitions.
  • Categories failed: size/alignment invariant preservation; allocation/free accounting invariant.
  • Categories passed: basic error cleanup on guard install failure (free on exception), thread-local/shared-state race surface (no new shared mutable races in reviewed paths), include/backport dependency consistency changes.
  • Assumptions/limits: static audit of PR diff/content only (no runtime execution/build logs in this pass).

@CarlosFelipeOR CarlosFelipeOR added the verified Approved for release label Jul 20, 2026
@zvonand
zvonand merged commit 9a5c713 into customizations/24.8.14 Jul 21, 2026
645 of 654 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

0