Skip to content

Instantly share code, notes, and snippets.

@lyind
Created November 12, 2019 10:17
Show Gist options
  • Save lyind/ae076548cafb2cb0b46a0819b749d6f4 to your computer and use it in GitHub Desktop.
Save lyind/ae076548cafb2cb0b46a0819b749d6f4 to your computer and use it in GitHub Desktop.
[UNDERTOW-1493] Undertow 2.0.20.Final XNIO I/O Thread 100% CPU test
#!/bin/bash
# Simple test for [UNDERTOW-1493] and similar TLSv1.3 half-open issues.
#
# NOTE: Requires a recent curl version, which should support HTTP2 and TLSv1.3.
#
# USAGE:
# 1. Run against a Undertow HTTP2, TLSv1.3 enabled server which MUST be located
# in a different network (ie. one or multiple routers in between the host
# executing this script and the target server).
# 2. Pull the network cable of the host executing this script (yes really). This will
# interrupt the TLS secured HTTP2 connections at various stages and expose bugs.
# 3. Check the Undertow servers CPU usage (especially XNIO I/O threads).
# 4. Plug network cable again and back to step 2 (~50% hit rate).
#
targetUrl="$1"
while true
do
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
curl --silent --tlsv1.3 --http2 "$targetUrl" >/dev/null 2>&1 &
wait
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment