Skip to content

Connection Problems

This guide covers network connectivity issues between Mantis components. The typical communication flow is:

Tarsus --[register/heartbeat]--> Mandible --[dispatch]--> Thorax --[execute]--> Tarsus

All inter-component communication uses mTLS, so connectivity problems may be network-level or TLS-level.

Step 1: Identify Which Connection Is Failing

Section titled “Step 1: Identify Which Connection Is Failing”
ConnectionProtocolDefault PortCheck Command
Client to Mandible (API)HTTPS3000curl https://host:3000/api/v1/health
Mandible to ThoraxgRPC (mTLS)50051Check /api/v1/health/grpc
Thorax to Mandible (internal)gRPC (mTLS)50052Check Thorax logs for connection errors
Tarsus to Mandible (register)gRPC (mTLS)50052Check Tarsus logs for registration errors
Tarsus to assigned ThoraxgRPC (mTLS)50051Check deployment execution logs (Tarsus dials Thorax; Thorax pushes over that connection in listen mode)
Mandible to PostgreSQLTCP5432psql $DATABASE_URL -c "SELECT 1"
Mandible to RabbitMQAMQP/TLS5671Check queue health in Mandible logs
Terminal window
# Test basic TCP connectivity
nc -zv thorax-host 50051
# Test with timeout
timeout 5 bash -c "echo > /dev/tcp/thorax-host/50051" && echo "Open" || echo "Closed"
# Check DNS resolution
nslookup thorax-host
dig thorax-host
Terminal window
# Test TLS handshake
openssl s_client -connect thorax-host:50051 \
-cert /etc/mantis/certs/mandible.crt \
-key /etc/mantis/certs/mandible.key \
-CAfile /etc/mantis/certs/ca.crt
# Check certificate details
openssl s_client -connect thorax-host:50051 < /dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates

Symptom: Connection times out rather than being refused.

Terminal window
# Check if port is reachable
nc -zv -w 5 target-host 3000
# Check local firewall rules (Linux)
iptables -L -n | grep -E "(3000|50051|50052)"
# Check firewall status
ufw status # Ubuntu
firewall-cmd --list-all # RHEL/CentOS

Fix: Open required ports between components:

FromToPortPurpose
Load balancerMandible3000API traffic
MandibleThorax50051Orchestration gRPC
ThoraxMandible50052Internal gRPC
ThoraxTarsus9342Command execution (listen mode)
TarsusMandible50052Registration/heartbeat (gRPC)
MandiblePostgreSQL5432Database
MandibleRabbitMQ5671Message queue

Symptom: Name or service not known or could not resolve hostname in logs.

Terminal window
# Verify DNS resolution
nslookup mandible-host
dig mandible-host +short
# Check /etc/hosts for local overrides
cat /etc/hosts | grep mantis
# In Docker, check service names resolve
docker compose exec thorax nslookup mandible

Fix: Ensure hostnames in configuration match DNS or /etc/hosts entries. In Docker Compose, use service names (e.g., mandible, thorax).

Symptom: Connection refused error immediately.

This means the port is reachable but nothing is listening.

  1. Verify the target service is running
  2. Check the service is binding to the expected address (not just 127.0.0.1 when accessed remotely)
  3. Confirm the port matches the configuration
Terminal window
# Check what's listening on the expected port
ss -tlnp | grep 3000
# or
netstat -tlnp | grep 3000

Symptom: Mandible logs show gRPC connection failed or circuit breaker opens.

Terminal window
# Check gRPC health. The circuit_state and failure_count fields are only
# returned to authenticated callers, so pass a token; an anonymous request
# shows only the overall status with an empty circuit_state.
curl -s -H "Authorization: Bearer $TOKEN" \
https://mantis.example.com/api/v1/health/grpc | jq
# If circuit breaker is open, check failure count
# The circuit breaker will attempt recovery in half-open state

Common gRPC causes:

  • Thorax is not running or crashed
  • TLS certificate mismatch between Mandible and Thorax
  • Network partition between Mandible and Thorax hosts
  • Thorax is overloaded and not responding to health checks

Symptom: Tarsus cannot register with Mandible.

  1. Verify Tarsus can reach Mandible’s internal gRPC port (default 50052)
  2. Check Tarsus certificate is signed by the trusted CA
  3. Ensure the registration endpoint is accessible
  4. Review Tarsus logs for specific error messages
Terminal window
# Test gRPC reachability from the Tarsus host (registration uses gRPC, not REST)
nc -zv mandible-host 50052

Symptom: Services cannot reach each other in Docker Compose.

Terminal window
# Verify all services are on the same network
docker network inspect mantis_default
# Test connectivity between containers
docker compose exec mandible ping thorax
docker compose exec mandible nc -zv thorax 50051

Symptom: port already allocated when starting containers.

Terminal window
# Find what's using the port
lsof -i :3000
# or
ss -tlnp | grep 3000
# Use alternative port mappings in docker-compose
# ports:
# - "3001:3000"