Overview
This guide covers common issues you may encounter when running Masar Eagle and provides systematic debugging strategies.Quick Diagnostics
Health Check Dashboard
First, check all service health endpoints:Service Dependencies
Verify the dependency graph (from AppHost.cs):Services use
.WaitFor() to ensure dependencies are ready before starting.Common Issues
Service Won’t Start
Database Connection Failed
Database Connection Failed
Symptoms:Diagnosis:Solution:
- Verify PostgreSQL container is running
- Check connection string format in appsettings.json
- Ensure databases are created:
users,trips,notifications,auth - Check
POSTGRES_HOST_AUTH_METHOD=trustenvironment variable (AppHost.cs:10)
RabbitMQ Connection Failed
RabbitMQ Connection Failed
Symptoms:Diagnosis:Solution:
- Verify RabbitMQ container is running
- Check username/password parameters (AppHost.cs:18-23)
- Ensure management plugin is enabled
- Verify port 5672 (AMQP) and 15672 (Management) are accessible
OpenTelemetry Collector Unreachable
OpenTelemetry Collector Unreachable
Symptoms:Diagnosis:Solution:
- Verify OTel Collector container is running
- Check
OTEL_EXPORTER_OTLP_ENDPOINTenvironment variable - Services must wait for collector:
.WaitFor(otelCollector)(AppHost.cs:39)
Port Already in Use
Port Already in Use
Symptoms:Solution:
Authentication Errors
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
Symptoms:Solution:
- Request authenticated but returns 403
- Error:
UserForbiddenException
- Verify user has required role (admin, driver, passenger, company)
- Check authorization policy in endpoint definition
- Review user claims in JWT token
Database Issues
Migration Failed
Migration Failed
Symptoms:Solution:The service will auto-apply migrations on startup (Program.cs:62-65):
Connection Pool Exhausted
Connection Pool Exhausted
Symptoms:Solution:
- Check for unclosed database connections
- Verify EF Core contexts are properly disposed
- Increase connection pool size if needed
- Monitor active connections:
Message Queue Issues
Messages Not Processed
Messages Not Processed
Symptoms:Wolverine Configuration:
Services publish to exchange and listen to queues (Program.cs:136-153):Solution:
- Messages sent but not received
- Queue depth increasing
- Verify queue bindings in RabbitMQ
- Check message handler registration
- Review Wolverine outbox for failed messages
- Ensure Postgres outbox is enabled for transactional messaging
Outbox Messages Stuck
Outbox Messages Stuck
Symptoms:Solution:
- Messages stored in outbox but not sent
- Verify RabbitMQ is accessible
- Check Wolverine background service is running
- Review error logs for serialization issues
Performance Issues
Slow Response Times
Slow Response Times
Diagnosis with Tracing:Common Causes:
Open Jaeger UI
Navigate to http://localhost:16686
Find Slow Trace
- Select service (user, trip, gateway)
- Set min duration filter (e.g., >1s)
- Search for traces
- N+1 query problem
- Missing database indexes
- Slow external API calls
- Large payload serialization
- Add eager loading:
.Include() - Create database indexes
- Add HTTP client timeout
- Enable response compression (already configured)
High Memory Usage
High Memory Usage
Diagnosis:Metrics to Monitor:
process_runtime_dotnet_gc_heap_size_bytesprocess_runtime_dotnet_gc_collections_countprocess_working_set_bytes
- Check for memory leaks (unclosed streams, event handlers)
- Review object pooling usage
- Monitor Gen 2 GC collections
- Adjust GC settings if needed
Thread Pool Starvation
Thread Pool Starvation
Symptoms:Solution:
- Ensure all I/O operations are async
- Avoid
Task.Wait()or.Result - Use
awaitconsistently - Review Hangfire worker count (Trips.Api Program.cs:121-125):
Debugging Strategies
Error ID Correlation
Every error gets a unique 16-character ID (GlobalExceptionMiddleware.cs:49):Request Tracing
Every gateway request gets anX-Request-Id header (RequestResponseLoggingMiddleware.cs:17-21):
Enable Detailed Logging
- Environment Variable
- appsettings.Development.json
SQL Query Logging
Enable EF Core query logging:HTTP Client Logging
Enable HTTP client request/response logging:Monitoring Alerts
Recommended Prometheus Alerts
Error Response Format
All errors follow RFC 7807 Problem Details format (GlobalExceptionMiddleware.cs:57-90):Getting Help
Check Logs
Start with structured logs in Grafana:
Check Traces
Use Jaeger to trace request flow:
http://localhost:16686
Check Metrics
Review service metrics in Grafana:
http://localhost:3000
Review Configuration
Verify environment variables and appsettings.json
Next Steps
Monitoring
Set up comprehensive monitoring
Scaling
Performance tuning and scaling considerations