Skip to main content
This guide covers common issues, diagnostic techniques, and solutions for Ant Media Server operations.

Diagnostic Tools

System Resource Information

Get comprehensive system status:

Thread Dumps

Capture thread dumps to diagnose deadlocks and performance issues (src/main/java/io/antmedia/statistic/StatsCollector.java:577):

Heap Dumps

Capture heap dump for memory analysis:

Log Files

Key log locations:

Performance Issues

High CPU Usage

Symptoms:
  • CPU usage consistently above 75%
  • Server rejecting new streams
  • Viewers experiencing buffering
Diagnostic Steps:
Solutions:
  1. Enable GPU encoding:
  2. Reduce transcoding:
  3. Increase CPU limit:
  4. Scale horizontally: Add more origin servers
  5. Optimize encoder settings:

High Memory Usage

Symptoms:
  • Memory usage above 75%
  • OutOfMemoryError in logs
  • Server becoming unresponsive
Diagnostic Steps:
Solutions:
  1. Increase JVM heap:
  2. Increase memory limit:
  3. Restart server periodically (temporary fix):
  4. Capture and analyze heap dump:

Database Performance Issues

Symptoms:
  • Slow API responses
  • High database query times
  • Cluster synchronization delays
Diagnostic Steps:
Solutions:
  1. Add database indexes:
  2. Use faster storage: SSD instead of HDD
  3. Increase MongoDB resources:
  4. Use MongoDB replica set with read preference:

Streaming Issues

Streams Not Publishing

Symptoms:
  • Publishers can’t start streams
  • “Encoder not opened” errors
  • Publish timeout errors
Diagnostic Steps:
Solutions:
  1. Check resource limits: CPU/memory may be at capacity
  2. Verify codec support:
  3. Check GPU availability:
  4. Review application settings:
    • Check codec settings
    • Verify resolution limits
    • Check bitrate constraints
  5. Check network connectivity: Firewall rules, port availability

Streams Not Playing

Symptoms:
  • Players can’t start playback
  • 404 errors on HLS manifests
  • WebRTC connection failures
Diagnostic Steps:
Solutions:
  1. Verify stream is live:
  2. Check CORS settings (for web players):
  3. Verify WebRTC settings:
    • STUN/TURN configuration
    • Port availability (UDP 50000-60000)
    • ICE candidates
  4. Test with different players: VLC, ffplay, browser

Poor Stream Quality

Symptoms:
  • Pixelation, artifacts
  • Buffering
  • Audio sync issues
Diagnostic Steps:
Solutions:
  1. Increase bitrate:
  2. Adjust encoder preset:
  3. Check network bandwidth:
  4. Enable adaptive bitrate:

Cluster Issues

Nodes Not Joining Cluster

Symptoms:
  • Node shows as DEAD
  • Node not visible in cluster
  • Database connection errors
Diagnostic Steps:
Solutions:
  1. Verify database configuration:
  2. Check network connectivity:
  3. Verify node group settings:
  4. Check MongoDB replica set status:
  5. Restart node:

Stream Not Found in Cluster

Symptoms:
  • Stream published on origin, not available on edge
  • 404 errors when playing from edge
  • Cluster routing failures
Diagnostic Steps:
Solutions:
  1. Verify cluster mode enabled on all nodes
  2. Check node groups match:
  3. Check database synchronization:
    • Ensure all nodes use same database
    • Verify replica set is healthy
  4. Restart edge nodes:

WebRTC Issues

ICE Connection Failures

Symptoms:
  • WebRTC connections timeout
  • No video/audio in player
  • ICE connection state: failed
Diagnostic Steps:
Solutions:
  1. Configure STUN server:
  2. Configure TURN server (for restrictive networks):
  3. Open UDP ports:
  4. Set server public IP:

High Latency

Symptoms:
  • Delay between publisher and viewer
  • Lag in interactive applications
  • Growing buffer
Diagnostic Steps:
Solutions:
  1. Reduce GOP size:
  2. Use WebRTC for playback: Lower latency than HLS
  3. Optimize encoder settings:
  4. Check network path: Use traceroute, check for packet loss
  5. Deploy closer to users: Use edge servers in multiple regions

System Health Checks

Automated Health Check Script

Make it executable and add to monitoring:

Getting Help

Collect Diagnostic Information

Before requesting support, collect:

Support Resources

Common Error Messages

”Encoder blocked”

  • Cause: Encoder initialization taking too long
  • Solution: Check GPU availability, reduce resolution/bitrate

”Publish timeout”

  • Cause: Stream initialization exceeded timeout
  • Solution: Check network, reduce encoder load, increase timeout

”Not enough resource”

  • Cause: CPU or memory limits exceeded
  • Solution: Increase limits or add more servers

”Database connection failed”

  • Cause: Cannot connect to MongoDB
  • Solution: Check MongoDB status, network, credentials

”Port already in use”

  • Cause: Another process using same port
  • Solution: Check with netstat, kill process or change port