Troubleshooting
TLS / Certificate Issues
Section titled “TLS / Certificate Issues””ACME challenge failed”
Section titled “”ACME challenge failed””Symptom: TLS certificate request fails with challenge error.
Causes:
- Port 80 not accessible (HTTP-01 challenge)
- DNS not pointing to server
- Firewall blocking Let’s Encrypt
Solutions:
# Check port 80 is opencurl http://your-domain.com
# Verify DNSdig your-domain.com
# Check firewallufw statusufw allow 80/tcpufw allow 443/tcp“Wildcard cert failed”
Section titled ““Wildcard cert failed””Symptom: Wildcard certificate (*.example.com) fails to issue.
Cause: Wildcard certs require DNS-01 challenge, not HTTP-01.
Solution: Use Caddy with DNS challenge for wildcard certificates:
# Generate Caddyfile with DNS providerten caddy --domain example.com --dns-provider cloudflare
# Set DNS token via environment for Caddyexport CF_API_TOKEN=$CF_TOKENcaddy run --config /etc/caddy/Caddyfile“Certificate expired”
Section titled ““Certificate expired””Symptom: HTTPS fails with certificate error.
Cause: Auto-renewal failed or tenement wasn’t running.
Solution:
# Restart to trigger renewalsystemctl restart tenement
# Check certificate statuscurl https://example.com/api/tls/statusPort Conflicts
Section titled “Port Conflicts””Address already in use”
Section titled “”Address already in use””Symptom: ten serve fails with “address already in use”.
Cause: Another process is using the port.
Solutions:
# Find what's using the portlsof -i :8080
# Kill it or use different portten serve --port 8081
# Or stop the conflicting servicesystemctl stop nginx“Permission denied” on port 80/443
Section titled ““Permission denied” on port 80/443”Symptom: Can’t bind to privileged ports.
Cause: Non-root user can’t bind ports below 1024.
Solutions:
# Option 1: Use Caddy (recommended)ten caddy --domain example.com
# Option 2: Use higher port + reverse proxyten serve --port 8080
# Option 3: Grant capability (not recommended)sudo setcap 'cap_net_bind_service=+ep' $(which ten)Cgroup / Resource Limit Issues
Section titled “Cgroup / Resource Limit Issues””Failed to create cgroup”
Section titled “”Failed to create cgroup””Symptom: Instances fail to spawn with cgroup error.
Causes:
- Not running on Linux
- cgroups v2 not available
- Permission denied
Solutions:
# Check cgroup versionmount | grep cgroup
# For cgroup v2, check if unifiedls /sys/fs/cgroup/cgroup.controllers
# Run as root or with proper permissionssudo ten serve
# Or disable resource limits in config[service.api]# Remove memory_limit_mb and cpu_shares“Memory limit not enforced”
Section titled ““Memory limit not enforced””Symptom: Process exceeds memory_limit_mb.
Cause: cgroups not properly configured.
Solutions:
# Verify cgroups v2cat /sys/fs/cgroup/cgroup.controllers
# Check if memory controller is enabledcat /sys/fs/cgroup/cgroup.subtree_control
# Enable memory controllerecho "+memory" | sudo tee /sys/fs/cgroup/cgroup.subtree_controlInstance Issues
Section titled “Instance Issues””Instance won’t start”
Section titled “”Instance won’t start””Symptom: ten spawn succeeds but instance immediately stops.
Diagnosis:
# Check logs via APIcurl -H "Authorization: Bearer $TOKEN" \ "http://localhost:8080/api/logs?process=api&instance=myid"
# Check if command existswhich my-command
# Test command manuallycd /var/lib/tenement/api/myid && ./my-commandCommon causes:
- Command not found
- Missing dependencies
- Permission issues
- Socket path doesn’t exist
”Health check failing”
Section titled “”Health check failing””Symptom: Instance shows “unhealthy” in ten ps.
Diagnosis:
# Check health endpoint directlycurl --unix-socket /tmp/tenement/api-myid.sock http://localhost/health
# Check instance logs via APIcurl -H "Authorization: Bearer $TOKEN" \ "http://localhost:8080/api/logs?process=api&instance=myid"Common causes:
- Health endpoint returns non-200
- Health endpoint path wrong in config
- Instance crashed but socket remains
”Socket not created”
Section titled “”Socket not created””Symptom: Instance starts but socket file doesn’t appear.
Causes:
- App not listening on socket
- Socket directory doesn’t exist
- Permission denied
Solutions:
# Create socket directorymkdir -p /tmp/tenement
# Check your app actually listens on socket# Python example:app.run(unix_socket=os.getenv("SOCKET_PATH"))
# Check socket path in config matches app[service.api]socket = "/tmp/tenement/api-{id}.sock"Routing Issues
Section titled “Routing Issues””404 on subdomain”
Section titled “”404 on subdomain””Symptom: myid.api.example.com returns 404.
Causes:
- Instance not running
- Wrong domain in
ten serve - DNS not configured for wildcard
Solutions:
# Check instance existsten ps
# Verify domain settingten serve --domain example.com
# Check DNS has wildcard recorddig *.example.com“Wrong instance routed”
Section titled ““Wrong instance routed””Symptom: Requests go to wrong instance.
Cause: Routing pattern mismatch.
Understanding routing:
v1.api.example.com→ direct toapi:v1api.example.com→ weighted across allapi:*
# Check weightsten ps
# Adjust weights if neededten weight api:v1 100ten weight api:v2 0Storage Issues
Section titled “Storage Issues””Storage quota exceeded”
Section titled “”Storage quota exceeded””Symptom: Instance shows warning or stops accepting writes.
Solutions:
# Check storage usagecurl https://example.com/api/instances/api:myid/storage
# Increase quota[service.api]storage_quota_mb = 500
# Or clean up old datarm -rf /var/lib/tenement/api/myid/cache/*“Data lost on restart”
Section titled ““Data lost on restart””Symptom: Instance data disappears after stop/start.
Cause: storage_persist = false in config.
Solution:
[service.api]storage_persist = true # Keep data on stopSystemd Issues
Section titled “Systemd Issues””Service won’t start”
Section titled “”Service won’t start””Symptom: systemctl start tenement fails.
Diagnosis:
# Check service statussystemctl status tenement
# Check logsjournalctl -u tenement -n 50
# Verify config by showing itTENEMENT_CONFIG=/etc/tenement/tenement.toml ten config“Service keeps restarting”
Section titled ““Service keeps restarting””Symptom: Service restarts repeatedly.
Cause: tenement crashing or config error.
Solutions:
# Check crash logsjournalctl -u tenement -n 100
# Test config manuallyTENEMENT_CONFIG=/etc/tenement/tenement.toml ten serve
# Increase restart delaysudo systemctl edit tenement# Add: RestartSec=30Debugging Deep Dive
Section titled “Debugging Deep Dive”For complex issues, use these advanced techniques.
Trace Process Startup
Section titled “Trace Process Startup”# Watch what tenement spawnsstrace -f -e trace=execve,clone ten spawn api --id test
# Check environment passed to processstrace -f -e trace=execve ten spawn api --id test 2>&1 | grep -A1 execveInspect Running Instance
Section titled “Inspect Running Instance”# Find the processps aux | grep api
# Check open files and socketslsof -p <PID>
# Check network connectionsss -tlnp | grep <PID>
# Check cgroup membershipcat /proc/<PID>/cgroupDebug Health Checks
Section titled “Debug Health Checks”# Manually test health endpointcurl -v http://127.0.0.1:<PORT>/health
# Check if port is listeningss -tlnp | grep <PORT>
# Watch health check requests (if your app logs them)tail -f /var/log/myapp.log | grep healthInspect Memory/CPU Limits
Section titled “Inspect Memory/CPU Limits”# Find cgroup pathINSTANCE_ID="api:prod"CGROUP="/sys/fs/cgroup/tenement/${INSTANCE_ID}"
# Check memory limitcat $CGROUP/memory.max
# Check current memory usagecat $CGROUP/memory.current
# Check CPU weightcat $CGROUP/cpu.weight
# Watch resource usagewatch -n 1 "cat $CGROUP/memory.current && cat $CGROUP/cpu.stat"Debug Namespace Isolation
Section titled “Debug Namespace Isolation”# Enter a namespace-isolated process's viewnsenter -t <PID> -p -m ps aux
# Check if /proc is isolatednsenter -t <PID> -p -m cat /proc/1/environMonitor tenement Server
Section titled “Monitor tenement Server”# Watch tenement logsRUST_LOG=debug ten serve 2>&1 | tee tenement.log
# Monitor metricswatch -n 1 "curl -s http://localhost:8080/metrics | grep instance"
# Check API response timescurl -w "@-" -o /dev/null -s http://localhost:8080/api/instances << 'EOF' time_namelookup: %{time_namelookup}s\n time_connect: %{time_connect}s\n time_appconnect: %{time_appconnect}s\n time_pretransfer: %{time_pretransfer}s\n time_redirect: %{time_redirect}s\n time_starttransfer: %{time_starttransfer}s\n ----------\n time_total: %{time_total}s\nEOFCheck Configuration Loading
Section titled “Check Configuration Loading”# Show parsed configten config
# Validate config syntaxcat tenement.toml | toml-json # if you have toml-json
# Check for duplicate service namesgrep '^\[service\.' tenement.toml | sort | uniq -dNetwork Debugging
Section titled “Network Debugging”# Test subdomain routing locallycurl -H "Host: prod.api.localhost" http://localhost:8080/
# Check DNS resolutiondig +short prod.api.example.com
# Test with explicit IPcurl -H "Host: prod.api.example.com" http://<SERVER_IP>:8080/Getting Help
Section titled “Getting Help”If these solutions don’t help:
- Check logs: API logs endpoint and
journalctl -u tenement - Search GitHub Issues
- Open a new issue with:
- tenement version (
ten --version) - OS and kernel version
- Config file (sanitized)
- Full error message
- Steps to reproduce
- tenement version (