Skip to content
/ oomlet Public

πŸ₯š OOMlet β€” Stress-test your system limits, scramble your memory, and crash cleanly.

License

Notifications You must be signed in to change notification settings

trcjr/oomlet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯š OOMlet

Build Status Develop Snapshot Security Scan

Coverage Develop Coverage Tests

Java Last Commit License

Crashing With Style

OOMlet β€” a lightweight, chaos-friendly QA and debugging Spring Boot application designed to help you test, stress, and harden your systems.

🍳 Crack limits. Scramble resources. Cook up resilience.


πŸ“š Table of Contents

πŸš€ Features

  • βœ… Dynamic health check toggling (pass/fail)
  • βœ… Simulate arbitrary HTTP response codes
  • βœ… Memory and file handle stress testing endpoints
  • βœ… CPU load simulation
  • βœ… Graceful OS signal handling (SIGINT, SIGTERM, USR1, USR2)
  • βœ… Runtime log level adjustment (dynamic)
  • βœ… Crash with specific exit codes
  • βœ… Outbound connectivity tester (ping a URL)
  • βœ… Simulate response latency
  • βœ… Full Actuator integration
  • βœ… Code coverage enforcement (80% minimum)
  • βœ… Built for local development, Docker, and Kubernetes
  • βœ… Kind cluster configuration with ingress support
  • βœ… Production-ready Helm charts with autoscaling

πŸ›  Quick Start

πŸ“‹ Prerequisites

  • Java 17+ (Temurin recommended)
  • Maven 3.8+ (no need to install if using the Maven Wrapper)

1. Build the application

./mvnw clean package

2. Run the application

java -jar target/oomlet-0.0.8.jar

(Optional) Override port:

SERVER_PORT=9090 java -jar target/oomlet-0.0.8.jar

πŸ“– API Endpoints

Endpoint Method Purpose
/actuator/health GET Standard Spring Boot health check
/api/health-toggle/enable POST Set custom health indicator to pass
/api/health-toggle/disable POST Set custom health indicator to fail
/api/status?responseCode=404 GET Simulate specific HTTP status responses
/api/open-files?count=100 GET Stress test file descriptor limits
/api/allocate-memory?bytes=104857600 GET Allocate memory blocks to stress JVM heap
/api/burn-cpu?millis=1000&threads=2 GET Generate CPU load
/api/ulimits GET View OS resource limits (parsed ulimit)
/api/logging/spring?level=DEBUG POST Change Spring framework log level dynamically
/api/crash?code=137 POST Exit the process with specific code
/api/ping?url=https://example.com GET Test outbound connectivity to a URL
/api/latency?delayMillis=1500 GET Simulate response latency for timeout testing

πŸ§ͺ Stress Testing Endpoints

Memory Allocation

curl 'http://localhost:8080/api/allocate-memory?bytes=104857600'

File Handle Load

curl 'http://localhost:8080/api/open-files?count=100'

CPU Burn

curl 'http://localhost:8080/api/burn-cpu?millis=5000&threads=4'

πŸ“‘ Connectivity & Delay Simulation

Outbound Ping

curl 'http://localhost:8080/api/ping?url=https://example.com'

Simulate Latency

curl 'http://localhost:8080/api/latency?delayMillis=1500'

πŸ’₯ Crash the Application

Use this to simulate process failure and container exit.

curl -X POST 'http://localhost:8080/api/crash?code=137'

πŸ”§ Runtime Configuration

Log Level Adjustment

curl -X POST 'http://localhost:8080/api/logging/spring?level=DEBUG'
curl 'http://localhost:8080/api/logging/spring'

JVM Memory Options

You can limit or expand memory usage for stress tests:

JAVA_OPTS="-Xmx512m -Xms128m" java -jar target/oomlet-0.0.8.jar

πŸ“¦ Docker and Kubernetes Support

Build Docker Image

docker build -t oomlet:latest .

Run Locally

docker run -p 8080:8080 oomlet:latest

🐳 Kind Cluster Setup (Recommended for Testing)

OOMlet includes comprehensive Kind cluster configuration for easy local Kubernetes testing with ingress support.

Prerequisites

Quick Start with Kind

Option 1: One-Button Setup (Recommended)

./scripts/setup-kind.sh

Option 2: Manual Setup

  1. Create Kind cluster with ingress support:

    kind create cluster --name kind --config kind-config.yaml
  2. Install NGINX Ingress Controller:

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
    kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=120s
  3. Deploy OOMlet with ingress:

    helm install oomlet ./helm -f helm/values-kind.yaml
  4. Add local DNS entry:

    echo "127.0.0.1 oomlet.local" | sudo tee -a /etc/hosts
  5. Test the deployment:

    curl http://oomlet.local/actuator/health

Configuration Files

  • kind-config.yaml: Kind cluster configuration with port mappings for ingress
  • helm/values-kind.yaml: Helm values optimized for Kind deployment with ingress enabled

Scripts

  • scripts/setup-kind.sh: One-button setup script for complete Kind cluster and OOMlet deployment
  • scripts/cleanup-kind.sh: Cleanup script to remove cluster and DNS entries

Testing OOM Scenarios

With the Kind setup, you can easily test various failure scenarios:

# Test memory allocation (causes OutOfMemoryError)
curl "http://oomlet.local/api/allocate-memory?bytes=2147483648"

# Test application crash (simulates pod failure)
curl -X POST "http://oomlet.local/api/crash?code=137"

# Test CPU stress
curl "http://oomlet.local/api/burn-cpu?millis=5000&threads=4"

# Test file handle limits
curl "http://oomlet.local/api/open-files?count=100"

Benefits of Kind Setup

  • βœ… One-button setup with ./scripts/setup-kind.sh
  • βœ… Direct ingress access on http://oomlet.local (no port forwarding)
  • βœ… Production-like environment for testing Kubernetes features
  • βœ… Easy cleanup: ./scripts/cleanup-kind.sh
  • βœ… Automatic pod recovery testing
  • βœ… Load balancer behavior simulation

βœ… Designed to be liveness- and readiness-probe friendly. βœ… Docker image built for minimal size and startup speed. βœ… Full Kubernetes ingress support with automatic failover.


βš™οΈ Configuration

Variable Purpose Example
SERVER_PORT Override server port SERVER_PORT=9090
JAVA_OPTS Pass JVM options JAVA_OPTS="-Xmx512m"

πŸ§ͺ Testing and Code Coverage

Run unit and integration tests:

./mvnw clean verify

Open coverage report:

open target/site/jacoco/index.html

View live coverage:

βœ… Enforced 80%+ line coverage. βœ… Build fails if coverage threshold not met. βœ… CI/CD runs on each push via GitHub Actions.

πŸ”’ Coverage Gate

This project enforces 80% minimum line coverage using JaCoCo.

Fail the build on low coverage by editing pom.xml:

<rule>
  <element>BUNDLE</element>
  <limits>
    <limit>
      <counter>INSTRUCTION</counter>
      <value>COVEREDRATIO</value>
      <minimum>0.80</minimum>
    </limit>
  </limits>
</rule>

Or use .codecov.yml in root:

coverage:
  status:
    project:
      default:
        target: 80%
        threshold: 1%

πŸ“œ Workflow Rules

All GitHub Actions workflows in this project follow strict rules for consistency and reliability. This includes:

  • βœ… Git short hashes must be set using git rev-parse --short HEAD and passed via $GITHUB_OUTPUT
  • βœ… Helm chart versions must be valid SemVer using the -dev.<short_hash> format
  • βœ… CI/CD steps are explicitly structured to avoid flakiness and ensure reproducibility

🚦 Signal Handling

OOMlet handles:

  • SIGINT (Ctrl+C)
  • SIGTERM (docker stop, kubectl delete pod)
  • SIGHUP, SIGQUIT, SIGUSR1, SIGUSR2

Gracefully shuts down or logs custom signals.

  • SIGUSR1 β€” logs current heap usage and active memory state
  • SIGUSR2 β€” logs thread dump and internal diagnostics

πŸ”’ Security

This project uses a comprehensive security approach with multiple layers of protection:

πŸ›‘οΈ Dependency Management

  • Dependabot: Automated dependency updates with security scanning
    • Weekly updates for Maven, GitHub Actions, and Docker dependencies
    • Daily security updates for critical vulnerabilities
    • Automatic PR creation with proper labeling and review assignment
    • Groups minor and patch updates to reduce PR noise

πŸ” Security Scanning

  • CodeQL Analysis: Static code analysis for Java vulnerabilities
  • Trivy Container Scanning: Docker image vulnerability scanning
  • GitHub Security Advisories: Integration with GitHub's security database

πŸ“‹ Security Workflow

The security scan workflow runs:

  • Scheduled: Every Sunday at midnight UTC
  • Manual: Via workflow dispatch
  • Docker Scanning: Container image vulnerability analysis
  • Code Scanning: Static analysis with CodeQL

🚨 Security Alerts

  • GitHub Security tab integration
  • Dependabot alerts for vulnerable dependencies
  • CodeQL alerts for code vulnerabilities
  • Container scanning alerts for image vulnerabilities

πŸ“Š Security Status

Security Scan


πŸ—Ί Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Client / User        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
        HTTP Requests
              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Spring Boot Server     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚         β”‚           β”‚              β”‚              β”‚
β”Œβ”€β”€β”€β–Όβ”€β”€β”€β” β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
β”‚statusβ”‚ β”‚open-filesβ”‚β”‚allocate β”‚ β”‚ /ulimits    β”‚ β”‚actuator   β”‚
β”‚      β”‚ β”‚          β”‚β”‚memory   β”‚ β”‚ burn-cpu    β”‚ β”‚ health, etcβ”‚
β””β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
              β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ SignalHandlerService        β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β–Ό
        Graceful Shutdown

πŸ“„ License

MIT β€” see LICENSE


✍️ Contributing

We welcome PRs and issues. Start with CONTRIBUTING.md Look for issues labeled good first issue to help out!

About

πŸ₯š OOMlet β€” Stress-test your system limits, scramble your memory, and crash cleanly.

Resources

License

Stars

Watchers

Forks

Packages