Michał Sz
04/13/2026, 2:23 PMPOST .../bulk/users occasionally returns HTTP 502 Bad Gateway: "Request timed out while connecting to horizon server"
It's not constant but keeps coming back intermittently.
We're running a local PDP pod in Docker.
Anyone aware of what might be causing this in that setup?
Thanks!Ask Inkeep
04/13/2026, 2:23 PMAsk Inkeep
04/13/2026, 2:23 PMPOST .../bulk/users endpoint returning HTTP 502 Bad Gateway errors with "Request timed out while connecting to horizon server" in the available sources.
However, the Horizon service is the PDP's internal Python service bridge that facilitates communication between different components within the PDP (1) . There are several timeout configurations that might be relevant:
• *PDP_HORIZON_CLIENT_TIMEOUT*: Default is 60 seconds for Horizon client requests
• *PDP_CONTROL_PLANE_TIMEOUT*: Default is 75 seconds for control plane requests, which includes proxied requests
A similar connectivity issue was reported in a GitHub issue where resource constraints on the sidecar caused OPA connection problems (2) . That issue was resolved by increasing the resources allocated to the sidecar container .
To help investigate this further, could you provide:
1. Which Workspace / Project / Env you are using
2. What calls are you performing (as SDK code or CURL)
3. Which PDP version you are running
4. Relevant logs from your PDP showing the 502 errors and any surrounding context
You might also want to check if your Docker container has sufficient resources allocated, and consider adjusting the PDP_HORIZON_CLIENT_TIMEOUT or PDP_CONTROL_PLANE_TIMEOUT environment variables if the issue persists (1) .Ask Inkeep
04/13/2026, 2:23 PMMichał Sz
04/13/2026, 2:30 PM[2026-04-13T14:12:02Z ERROR pdp_server::api::horizon_fallback] Failed to send request: error sending request for url (<http://0.0.0.0:7001/v2/facts/titan/staging/bulk/users>) (None)
URL: <http://0.0.0.0:7001/v2/facts/titan/staging/bulk/users>
Error details: reqwest::Error { kind: Request, url: "<http://0.0.0.0:7001/v2/facts/titan/staging/bulk/users>", source: TimedOut }
Source error: Some(TimedOut)
2026-04-13T14:12:02.829978+0000 | uvicorn.protocols.http.httptools_impl | INFO | 127.0.0.1:37452 - "GET /healthy HTTP/1.1" 200
2026-04-13T14:12:03.127860+0000 | httpx._client | INFO | HTTP Request: POST <https://api.permit.io/v2/facts/[sanitized]/[sanitized]/bulk/users> "HTTP/1.1 504 Gateway Time-out"Or Weis
04/13/2026, 2:31 PMAsk Inkeep
04/13/2026, 2:31 PMAsk Inkeep
04/13/2026, 2:31 PM/v2/facts/titan/staging/bulk/users endpoint (1) . The error indicates reqwest::Error { kind: Request, url: "<http://0.0.0.0:7001/v2/facts/titan/staging/bulk/users>", source: TimedOut }.
This is an internal PDP communication timeout between components. The subsequent 504 Gateway Time-out from <http://api.permit.io|api.permit.io> suggests the request is also timing out at the control plane level.
A similar sidecar connectivity issue was resolved by increasing container resources . For your Docker setup, check:
1. *Container resource allocation* - Ensure your PDP pod has sufficient CPU and memory
2. *Timeout configurations* - Consider increasing these environment variables:
• PDP_HORIZON_CLIENT_TIMEOUT (default: 60 seconds)
• PDP_CONTROL_PLANE_TIMEOUT (default: 75 seconds)
3. *Network configuration* - Since you're using 0.0.0.0:7001, verify internal container networking is functioning properly
The intermittent nature suggests resource contention or temporary network issues within your Docker environment. Try allocating more resources to your PDP container first, as this resolved a sAsk Inkeep
04/13/2026, 2:31 PMThomas
04/13/2026, 6:07 PMMichał Sz
04/14/2026, 8:37 AM<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
</body>
</html>
and all the time utilization is on low levels:Or Weis
04/14/2026, 9:00 AMAsk Inkeep
04/14/2026, 9:00 AMAsk Inkeep
04/14/2026, 9:00 AM<http://api.permit.io|api.permit.io> after increasing your PDP timeouts to 120 seconds suggests the bottleneck is now at the control plane level, not within your local PDP (1) .
Since your resource utilization is low and you've already increased PDP_HORIZON_CLIENT_TIMEOUT and PDP_CONTROL_PLANE_TIMEOUT to 120 seconds , the issue appears to be:
1. *Control plane timeout* - The default PDP_CONTROL_PLANE_TIMEOUT is 75 seconds and covers "proxied requests for the Consistent Updates APIs" . You've set it to 120 seconds, but the control plane itself at <http://api.permit.io|api.permit.io> may have its own timeout limit that's being hit.
2. *Bulk payload size* - The /v2/facts/.../bulk/users endpoint may be timing out due to the size of your bulk operation. The available sources discuss bulk permission checks (2) but don't specifically document limits for bulk user operations.
*Next steps:*
Since this is a recurring issue with the bulk users endpoint specifically and you're running PDP v0.9.9, I'd recommend:
• Reach out to Permit.io support at help@permit.io with your findings
• Consider breaking your bulk users payload into smaller batches
• Check if there's a proxy or load balancer between your PDP and <http://api.permit.io|api.permit.io> that might have its own timeout
To help engineers investigate further, please share:
1. The approximate size/count of users in your bulk requests
2. Your full PDP configuration (sanitized)
3. Whether this happens with all bulk user operations or only above a certain size thresholdAsk Inkeep
04/14/2026, 9:00 AMOr Weis
04/14/2026, 9:01 AM• Consider breaking your bulk users payload into smaller batches
• Check if there’s a proxy or load balancer between your PDP andWhat’s your current bulk batch size?that might have its own timeout<http://api.permit.io|api.permit.io>
Michał Sz
04/14/2026, 9:04 AMdavid
04/14/2026, 9:05 AMMichał Sz
04/21/2026, 8:46 AM