Hi, I'm facing a random error with status code of...
# ask-ai
c
Hi, I'm facing a random error with status code of 503, while triggering the Egress RoomCompositeEgressRequest API to start the video recording. Code: """ livekit_client = api.LiveKitAPI( url=api_url, api_key=os.environ.get("LIVEKIT_API_KEY"), api_secret=os.environ.get("LIVEKIT_API_SECRET"), timeout=aiohttp.ClientTimeout(total=90.0, connect=15.0) # 90s total (allows for Chrome startup + overhead), 15s connect ) # 🎯 ENHANCED: RoomComposite recording captures ALL room activity automatically # This includes all participants, agent responses, and user interactions req = api.RoomCompositeEgressRequest( room_name=ctx.room.name, audio_only=False, # Capture both audio and video for complete session layout="speaker", # Focus on active speaker (agent or user) # 🚀 PRODUCTION: Use reliable encoding preset preset=api.EncodingOptionsPreset.H264_720P_30, custom_base_url=custom_base_url, file_outputs=[api.EncodedFileOutput( file_type=api.EncodedFileType.MP4, filepath=storage_path, s3=api.S3Upload( endpoint=minio_egress_endpoint, bucket=os.environ.get("MINIO_BUCKET_INTERVIEWS"), region="us-east-1", access_key=os.environ.get("MINIO_ACCESS_KEY"), secret=os.environ.get("MINIO_SECRET_KEY"), force_path_style=True ) )] ) response = await livekit_client.egress.start_room_composite_egress(req) egress_id = response.egress_id """ Error details: TwirpError(code=unavailable, message=twirp error unknown: no response from servers, status=503) So, how we can handle this?
t
Thanks for reaching out, Abdul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to help you get to the bottom of that 503 error! Could you share a bit more about your setup? For example: • Are you running a self-hosted LiveKit server, or are you using the managed LiveKit Cloud? • Is this error happening all the time, or just now and then? • Have you had a chance to peek at the server logs to see if there are any extra error messages or hints? • Do you know if there might be any network restrictions or firewalls that could be affecting the connection? Getting these details will really help us figure out what's going on and find a solution together.
c
Yes, we are hosting this as a self-hosted service for Livekit, Livekit egress. And this is not happening consistenly, at a random case it is happening. And in the agent running script service, I'm getting this log, TwirpError(code=unavailable, message=twirp error unknown: no response from servers, status=503) And in the Livekit server, I'm able to see this log, 2025-10-01T114628.245Z INFO livekit.api service/twirp.go:128 API Egress.StartRoomCompositeEgress {"service": "Egress", "method": "StartRoomCompositeEgress", "room": "interview-mg7x6vsf", "baseUrl": "http://recording-template-qa:7681", "outputType": "file", "duration": "22.472289777s", "status": "503", "error": "twirp error unknown: no response from servers", "code": "unavailable"} And the Livekit and egress yaml files are, livekit.yaml: """ port: 7880 bind_addresses: - "0.0.0.0" # Bind to all interfaces for container networking rtc: tcp_port: 7881 udp_port: 7882 port_range_start: 50000 port_range_end: 50200 use_external_ip: false # Use internal IPs for Docker networking # Exclude Docker virtual interfaces interfaces: excludes: - "docker0" - "br-" - "veth" redis: address: redis-qa:6379 db: 0 keys: zeascreen_api_key: zeascreen_interview_secret_2025_secure development: false # Production mode for QA logging: level: info pion_level: warn room: auto_create: true empty_timeout: 300 # Delete empty rooms after 5 minutes departure_timeout: 20 """ egress.yaml: """ api_key: "" api_secret: "" ws_url: ws://livekit-qa:7880 redis: address: redis-qa:6379 db: 0 log_level: info # debug, info, warn, or error health_port: 9090 # HTTP port for health checks prometheus_port: 9091 # Prometheus metrics port # Template configuration template_port: 7980 # Port used to host default templates template_base: http://recording-template-qa:7681 # Custom template host # Security settings insecure: true # Allow insecure websocket (for internal Docker network) enable_chrome_sandbox: false # Chrome sandboxing disabled for Docker # File upload config - S3 compatible (MinIO for QA) s3: access_key: "" secret: "" region: us-east-1 endpoint: http://minio-qa:9000 bucket: interviews force_path_style: true """ So, these are the details and configs we are using in our application.
t
I'm sorry to hear you're experiencing the 503 error with the message "no response from servers." This usually means that the Egress client in the main LiveKit server is having trouble communicating with the Egress worker service. Let's work through some steps together to help you troubleshoot and hopefully resolve this: 1. Verify Egress Service Status: First, please check that your
livekit-egress
process or Docker container is up and running. It’s also a good idea to look at the logs to see if there are any crashes or startup errors. 2. Review Resource Allocation: Make sure your Egress instance has at least 4 CPUs and 4 GB of RAM, as recommended. You can use system monitoring tools to keep an eye on CPU and memory usage, especially when the system is under load. 3. Implement Automated Health Checks: Setting up the
health_port
in your
egress.yaml
is a great way to monitor the health of the Egress service. You can test it easily with a command like:
curl -f http://<your-egress-host>:<health-port>/
4. Validate Network Connectivity: Please ensure that the main LiveKit server can connect to both the Egress service’s
health_port
and the Twirp RPC endpoint. Sometimes network restrictions or firewalls can block this communication. 5. Check Chrome Sandboxing: If you’re running RoomComposite jobs, double-check that Chrome sandboxing is set up correctly. For Docker users, adding
--cap-add=SYS_ADMIN
to your command can help. 6. Check IO Connection: Lastly, verify that the Egress service’s connection to the IO service is stable, as any issues here might cause instability. By going through these points, you should be able to pinpoint and fix what’s causing those intermittent 503 errors. If you run into any questions or need a hand with any of these steps, please don’t hesitate to reach out—I’m here to help! Sources: pkg/service/egress.go | livekit/livekit_egress.twirp.go | Self-hosting the Egress Service | LiveKit Docs | livekit-agents/livekit/agents/worker.py | pkg/info/io.go
n
@creamy-account-25417 you need to increase the number of egress containers to support a lot of concurrent calls
t
It looks like adding more Egress containers might be a great way to better handle the load and help reduce those frustrating 503 errors during concurrent calls. Just make sure your infrastructure can support the extra containers and that each one has at least 4 CPUs and 4 GB of RAM, as recommended. If you'd like, I’m here to guide you through scaling your Egress setup or setting up load balancing—just let me know how I can help!
c
Hi @nice-fish-21757 Thanks for your suggestion. We are facing this 503 error from yesterday only and also in a random case. And more importantly, in the testing phase itself, where a single request is processing, at that time also, we are facing this 503 in a random case. So, Is that increasing the number of containers is the possible solution to solve this? or is there any other configs we need to modify in the livekit and egress yamls ? Attaching below our current livekit and egress yamls for your ref. Your suggestions will be greatly helpful. Thanks in advance. livekit.yaml: port: 7880 bind_addresses: - "0.0.0.0" # Bind to all interfaces for container networking rtc: tcp_port: 7881 udp_port: 7882 port_range_start: 50000 port_range_end: 50200 use_external_ip: false # Use internal IPs for Docker networking # Exclude Docker virtual interfaces interfaces: excludes: - "docker0" - "br-" - "veth" redis: address: redis-qa:6379 db: 0 keys: zeascreen_api_key: "" development: false # Production mode for QA logging: level: info pion_level: warn room: auto_create: true empty_timeout: 300 # Delete empty rooms after 5 minutes departure_timeout: 20 egress.yaml: api_key: "" api_secret: "" ws_url: ws://livekit-qa:7880 redis: address: redis-qa:6379 db: 0 log_level: info # debug, info, warn, or error health_port: 9090 # HTTP port for health checks prometheus_port: 9091 # Prometheus metrics port # Template configuration template_port: 7980 # Port used to host default templates template_base: http://recording-template-qa:7681 # Custom template host # Security settings insecure: true # Allow insecure websocket (for internal Docker network) enable_chrome_sandbox: false # Chrome sandboxing disabled for Docker # File upload config - S3 compatible (MinIO for QA) s3: access_key: "" secret: "" region: us-east-1 endpoint: http://minio-qa:9000 bucket: interviews force_path_style: true
t
I understand how those intermittent 503 errors during single request processing can be frustrating. Let’s work through some configuration adjustments and checks that might help improve the situation: 1. Resource Allocation: It’s important to make sure each Egress instance has at least 4 CPUs and 4 GB of memory. Sometimes, not having enough resources can cause instability, even if you’re only handling a single request. 2. Autoscaling: While autoscaling might not seem directly relevant for single requests, enabling it in your
egress.yaml
can be a great safety net for unexpected spikes. You can set: â—¦
autoscaling.enabled: true
â—¦ Adjust
targetCPUUtilizationPercentage
and `minReplicas`/`maxReplicas` to fine-tune the scaling behavior. 1. Graceful Termination: Increasing
terminationGracePeriodSeconds
(for example, to 3600 seconds) allows Egress instances to shut down smoothly without interrupting ongoing processes. 2. Health Checks: Double-check that the
health_port
is correctly configured and monitored. This helps detect any unresponsive instances quickly and recover from them. Trying out these adjustments should bring more stability to your setup. If you’d like, I’m here to help guide you through implementing any of these changes or answer any questions you have! Sources: Self-hosting the Egress Service | LiveKit Docs | egress/values.yaml
c
2025-10-02T102639.454Z INFO egress info/io.go:178 egress_aborted {"nodeID": "NE_FNGpTb235PLU", "clusterID": "", "egressID": "EG_oNdEcgiT4DbP", "requestType": "room_composite", "outputType": "file", "error": "Start signal not received", "code": 412, "details": "End reason: Source closed"} What may be the issue for this error?
t
I'm sorry to hear you're encountering the error "Start signal not received" with code 412 and "End reason: Source closed." It seems like the Egress process is having trouble starting properly. To help you better, could you please share a bit more about your situation? • Does this error happen every time or just occasionally? • Are there any particular actions or conditions that seem to trigger this error? • Have you had a chance to look at the logs from the LiveKit server and Egress service around when the error occurs? • Is the source (like the room or media) active and accessible when you make the Egress request? Getting these details will really help us figure out what's going on and find the best solution together.
c
This is happening when deployed in a new env. What may be cause for this error? In code side? or in config side?
t
I'm sorry to hear you're encountering the "Start signal not received" error with code 412 and the "End reason: Source closed" message. This usually happens when the Egress process doesn't start up as expected, especially in a new setup where configuration details might need a little fine-tuning. Let's walk through some important points together to help get this resolved: 1. Access Token: Please make sure the access token you're using for the Egress request includes the
RoomRecord
permission. If you're unsure, generating a fresh token might be a good idea. 2. WebSocket URL: Double-check that the
WsUrl
in your
egress.yaml
is correct and accessible. It should look like
wss://your-domain.com
. 3. Source Availability: It's important that the room and participants are active and publishing tracks when you make the Egress request. If the source isn't available, the process will unfortunately fail. 4. Room Name: Take a moment to verify that the
roomName
parameter in your Egress request exactly matches an existing room on your server. 5. Egress Service Configuration: Make sure the Egress service is up and running with the right configuration. If you've updated anything recently, restarting the service can often help. Also, checking the Egress service logs can give you more detailed clues about what's going on. Please feel free to reach out if you'd like me to guide you through any of these steps or if you have any other questions. I'm here to help! Sources: livekit/livekit_egress.go | lib/livekit/egress_service_client.rb | Deploy to Kubernetes | LiveKit Docs | pkg/server/server_rpc.go | pkg/service/egress.go
c
WORKER_POOL_SIZE=1 So, this param in the egress config yaml, what it the main use of this? and this makes the 503 error if at a time trying to connect 2 sessions or recording sessions?
t
Thanks for reaching out! The parameter
WORKER_POOL_SIZE
in the Egress configuration is really important because it controls how many worker processes or instances are available to handle your egress jobs. If this value is set too low, it might limit your system’s ability to process multiple egress requests at the same time, especially for resource-heavy tasks like RoomComposite recordings. When you’re dealing with multiple sessions or recording requests, not having enough workers could cause timeouts or make the service unavailable, which might lead to those frustrating 503 errors. To help with this, here are a few friendly suggestions: 1. Make sure the
WORKER_POOL_SIZE
matches what you expect for your workload and the resources you have available. 2. Keep an eye on your Egress instances’ CPU and memory usage to make sure they’re not getting overwhelmed. 3. If you expect a lot of concurrent activity, think about scaling out by adding more Egress instances. 4. Also, check your LiveKit plan for any concurrency limits, since hitting those could cause requests to fail. If you’d like, I’m here to help you adjust this parameter or figure out the best way to scale your setup. Just let me know! Sources: Universal Egress | examples/egress.yaml | Quotas and limits | LiveKit Docs | Self-hosting the Egress Service | LiveKit Docs | Universal Egress
c
yes, for a single container, and this is having a CPU of 6 cores, and the memeory of 4GM. And in this case, If 2 sessions are going means, at that time if one is triggered and processed by the egress means the next request is not hitting and retryng for 3 times, and if it exceeds and breaks. And if the in the retry time, the previous session is clsoed means, then it is connected to the egress and egress starts recording this. Now, what is the issue? and the worker we are setting here is, - WORKER_POOL_SIZE=1 So, why the problem? is that worker size is also a prob? or what?
t
Setting
WORKER_POOL_SIZE=1
in your Egress configuration means the system is limited to just one worker, which can only manage one recording session at a time. This can create a bit of a bottleneck, especially with resource-heavy tasks like RoomComposite recordings that need a good amount of CPU and memory. So, when a second session starts while the first one is still running, the request gets queued or retried. If the first session finishes during the retry period, the second session can move forward smoothly. But if all the retries happen before the first session ends, unfortunately, the second request will fail. Here are some steps you can take to fix this: 1. Increase `WORKER_POOL_SIZE`: Try setting this to a higher number so multiple workers can handle sessions at the same time. Just make sure your system has enough CPU and memory to support the extra workers. 2. Scale Horizontally: Consider deploying more Egress instances to spread out the load and manage more concurrent requests. 3. Monitor Resource Usage: Keep an eye on CPU and memory usage with monitoring tools to ensure your Egress instance is handling the workload comfortably. By increasing the worker pool size or adding more instances, you’ll be able to handle multiple recording sessions much more smoothly. If you’d like, I’m here to help you through these changes—just let me know! Sources: Universal Egress | LiveKit Pricing | Deployment and scaling | LiveKit Docs | README.md
c
If I didnt set anything means, how many workers will set? by default?
t
I understand it can be a bit tricky, but the default value of
WORKER_POOL_SIZE
in LiveKit Egress isn't clearly documented in the resources we have. If you don’t set it, the system might just use some built-in defaults from the Egress service code. To help everything run smoothly and avoid any slowdowns, it’s a good idea to set this parameter yourself based on how much work you expect and the resources your system has. If you’d like, I’m here to help you figure out the best way to configure it—just let me know!
c
CHROME_POOL_SIZE=1 What is the purpose and control of ths param? in the egress??
t
I understand that the parameter
CHROME_POOL_SIZE
isn’t clearly documented in the available resources for LiveKit Egress, and that can be a bit confusing. Since Room Composite and Web Egress types use Chrome for rendering and recording, this parameter likely controls how many Chrome instances can run at the same time. If you’re running into any issues or need help figuring out how to configure this parameter, please feel free to reach out. I’m here to assist you based on your specific situation, and if needed, I can also escalate your question to get more detailed information. Your experience matters, so let's work through this together! Sources: README.md | Self-hosting the Egress Service | LiveKit Docs | gst/gst_buffer_pool.go
c
cpu_cost: room_composite_cpu_cost: 2.0 web_cpu_cost: 2.0 track_composite_cpu_cost: 1.5 track_cpu_cost: 1.0 What are these params in the egress config yaml file, and is these params also controls the concurrent recording handling of egress service?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
c
max_pulse_clients Is this is the param in the cpu_cost? in the egress config allowed params list?
So, we are using livekit agent events, and we are registering multiple events, and some of them are, session.on("ended", on_session_ended) session.on("conversation_ended", task()) ctx.room.on("disconnected", task()) ctx.add_shutdown_callback(livekit_shutdown_callback) So, here out of these, which and all is very important and stable one, which will be called in all the scenarios like when the interview is interrupted and when the interview tab is closed etc.
g
I am facing the same issue with 503 on egress server, and it also happens randomly. May i check if you are able to resolve this issue yet? @creamy-account-25417