Skip to content

Fix native JBCS extraction and CI test flakiness - #14

Merged
jbliznak merged 16 commits into
modcluster:mainfrom
honza-kasik:fix-native-unzip-symlinks
Jul 23, 2026
Merged

jbliznak merged 16 commits into
modcluster:mainfrom
honza-kasik:fix-native-unzip-symlinks

Conversation

@honza-kasik

@honza-kasik honza-kasik commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor
  • Fix JBCS ZIP extraction to preserve symlinks by using native unzip instead of Java's ZipInputStream
  • Patch httpd.conf post-extraction (ServerRoot, User/Group, DocumentRoot, conf.d cleanup) for non-root native execution
  • Fix multiple CI-flaky tests caused by the initial-load=0 / status-interval=10s transient window where newly registered workers haven't reported real load factors yet

Test flakiness fixes

With these fixes, passrate is now 99.84% 99.87% across 134 platform combinations.

  • testLoadDistributionAcrossWorkers / testLoadBasedRouting — poll with Awaitility until load distribution stabilizes instead of asserting immediately after worker registration
  • testHeapLoadMetric — increase HTTP read timeout for 500MB memory allocation request (new HEAVY_REQUEST constant, 60s)
  • testWebSocketFailover — use balancer management API (awaitContextRegistered) to confirm both workers have /ws-echo registered before connecting
  • testSessionAffinityWithMultipleClients — poll until JSESSIONID contains a JVM route suffix before testing sticky affinity
  • testJvmRouteLostJoinAtRuntime — replace manual retry loop with Awaitility polling for JSESSIONID cookie after Infinispan state transfer
  • testLoadDistribution (HttpClient) — treat null-worker responses as routing failures instead of counting them as valid hits

Java's ZipFile does not handle Unix symlinks — it extracts them as
tiny regular files containing the symlink target path. This broke
httpd startup on RHEL with "libaprutil-1.so.0: file too short".

Falls back to Java extraction only when unzip is not installed.
The JBCS ZIP ships with a pre-generated httpd.conf whose ServerRoot
points to the original build path, which does not exist on CI nodes.
The JBCS httpd.conf ships with User/Group set to "apache" which
does not exist on CI nodes. These directives are unnecessary when
httpd runs as a non-root user.
The JBCS httpd.conf points DocumentRoot to /var/www/html which does
not exist on CI nodes. The testsuite does not serve static files so
DocumentRoot is not needed.
The JBCS distribution ships various conf.d/ files (ssl.conf,
mod_cluster-native.conf, etc.) that reference system paths not
present on CI nodes. Clean them all out instead of removing them
one by one.
@honza-kasik
honza-kasik requested a review from jajik July 20, 2026 09:43
@jajik

jajik commented Jul 20, 2026 •

Copy link
Copy Markdown
Member
  • Patch ServerRoot in httpd.conf to the actual extraction directory, and comment out User, Group, and DocumentRoot directives that reference system paths/users not present in the test environment.

Isn't this caused by the missing .postinstall execution? I don't see it, but maybe I'm blind.

@honza-kasik

Copy link
Copy Markdown
Contributor Author

@jajik Good point, thank you! I will switch this to Draft and investigate.

@honza-kasik
honza-kasik marked this pull request as draft July 20, 2026 10:30
Use a .done marker file instead of httpd.conf existence to detect
whether postinstall has already run. Search for the postinstall script
across multiple locations (root, etc/, walk up to 3 levels) to handle
varying JBCS layouts. Downgrade non-zero exit codes to warnings since
non-root execution is expected to fail partially.

Remove ServerRoot and DocumentRoot patching from patchHttpdConf() as
these are now handled by the postinstall script itself.
Responses where httpd returns its own error page (e.g. 503) instead of
proxying to a backend produced null worker names that were silently
added to the distribution map. This caused waitForWorkerRegistration
to falsely pass when {null, worker1} satisfied the hasSize(2) check,
allowing tests to proceed before all workers had actually registered.

Count null-worker responses as failures in testLoadDistribution and
filter null keys in waitForWorkerRegistration so it keeps polling
until the expected number of real workers appear.
The testLoadDistributionAcrossWorkers test was asserting the ratio
immediately after confirming both workers exist, but a newly registered
worker starts with initial-load=0 and only gets a real load factor after
the next status-interval tick (10s). Move the ratio check into the
await loop so it polls until distribution actually stabilizes.
Same fix as testLoadDistributionAcrossWorkers: poll until distribution
stabilizes instead of measuring immediately after worker registration,
when initial-load=0 causes skewed routing.
The 500MB memory allocation request can stall beyond the default 10s
read timeout under CI load due to GC pressure. Use a dedicated
HEAVY_REQUEST timeout constant (30s) for this call.
A single HTTP 200 only confirms one worker has the ws-echo context;
the WebSocket upgrade can be routed to the other worker that hasn't
registered yet, causing the connection to fail.
…lients

With initial-load=0, a worker may not get a JVM route appended to
JSESSIONID until the balancer receives a STATUS message, causing
extractWorkerFromSessionId to return "unknown".
…loop

After stopping worker2 in a previous cycle, Infinispan state transfer
can cause worker1 to return HTTP 200 without a JSESSIONID cookie.
Replace the manual retry loop with Awaitility polling, bounded by
STATE_TRANSFER_REQUEST timeout.
waitForWorkerRegistration parses worker names from response bodies,
which the ws-echo static HTML page does not contain. Use
awaitContextRegistered to query the balancer directly instead.
30s still insufficient for 500MB allocation under CI GC pressure.
Even after waitForWorkerRegistration confirms both workers serve
traffic, a transient initial-load=0 window can produce a route-less
JSESSIONID cookie, causing assignedWorker to be "unknown".
@honza-kasik honza-kasik changed the title Fix native httpd (JBCS ZIP) extraction and configuration to work correctly on real Linux installs. Fix native JBCS extraction and CI test flakiness Jul 22, 2026
@honza-kasik
honza-kasik marked this pull request as ready for review July 22, 2026 11:40
@honza-kasik
honza-kasik requested a review from a team July 23, 2026 10:18

@martinchoma martinchoma left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approving per good CI results and no obvious problem in changes.

@jbliznak
jbliznak merged commit b1adba0 into modcluster:main Jul 23, 2026
10 checks passed
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.

4 participants