{"id":"IL-0123","org":"OpenAI","date":"2023-11-08","docs":[],"title":{"en":"A response buffer allocated anew in a loop made OpenAI's routing layer nodes hit their memory limits and fail readiness checks on a morning with more completions than any day before, causing 502 and 503 errors across all models","ko":"응답 버퍼를 재사용하지 않는 버그로 라우팅 계층 노드가 메모리 한도에 걸려 레디니스 검사에 실패했고, 트래픽이 몰리자 남은 노드가 모자라 모든 모델에서 요청 상당수가 502, 503 오류로 실패했다."},"domain":["ai-infra"],"impact":{"scope":"all models and API endpoints, ChatGPT and the API","users":"unknown","region":"unknown"},"review":{"written_by":"session","reviewed_at":null,"reviewed_by":null},"lessons":null,"related":[],"sources":[{"url":"https://status.openai.com/incidents/01JMYB63BJ47J3SXV6KSCT4D2A/write-up","kind":"official-status","license":"unknown","archived":null}],"summary":{"en":"OpenAI's routing layer had a chronic memory problem: its code allocated a new responseBuffer on every pass of a loop instead of reusing one, and garbage collection fell behind, especially under many requests. On a morning with dramatically more completions than any earlier day, routing nodes reached their memory limits and failed readiness checks, until too few nodes were left to carry the traffic and the service could not recover.\n\nOpenAI ended the outage by limiting incoming traffic, redeploying the service en masse and then ramping traffic back up slowly. Afterwards the code was changed to pre-allocate the buffer and reuse it, which brought a 3X improvement in both memory and CPU usage. The memory limits were set to an appropriate level with significant headroom, rate limit controls were added to shed load more gracefully, and capacity was increased. Autoscaling had not been possible for this service because adding capacity could hurt an upstream service; that issue has been fixed and autoscaling is to be configured.","ko":"2023년 11월 8일 태평양 시각 오전 5시 42분부터 7시 16분까지 OpenAI 로 가는 요청 상당수가 502 나 503 오류로 실패했다. 모든 모델과 API 엔드포인트가 영향을 받았다. 라우팅 계층 노드가 메모리 한도에 걸려 레디니스 검사에 실패했다. 사용할 수 없는 노드가 충분히 많아지자 남은 용량으로는 들어오는 트래픽을 감당하지 못했다. 서비스는 스스로 회복하지 못했다. OpenAI 는 그날 아침 completion 수가 그전 어느 날보다 훨씬 많았던 것을 결정적 계기로 보고 있다.\n\n메모리 문제의 바탕에는 버그가 있었다. 코드가 루프 안에서 responseBuffer 를 재사용하지 않고 계속 새로 할당했다. 특히 요청이 많을 때 GC 가 이를 따라가지 못했다. 팀은 들어오는 트래픽을 제한하고 서비스를 한꺼번에 재배포한 뒤 트래픽을 천천히 다시 올려 장애를 줄였다. 이후 버퍼를 미리 할당해 재사용하도록 코드를 고쳤다. 이 수정을 배포한 뒤 메모리와 CPU 사용량이 모두 3배 개선됐다.\n\n이 서비스는 용량을 늘리면 상위 서비스에 나쁜 영향을 줄 수 있어서 그동안 오토스케일링을 켤 수 없었다. 지금은 그 문제를 바로잡았고, 이 서비스에 오토스케일링을 설정할 예정이다."},"trigger":{"en":"A morning with dramatically more completions than any previous day pushed the routing layer nodes, which already had a chronic memory problem, past their memory limits.","ko":"그날 아침 completion 요청이 그전 어느 날보다 훨씬 많이 들어왔다."},"severity":"unknown","symptoms":["high-error-rate","service-unavailable","readiness-probe-failures"],"timeline":{"detected_after":null,"resolved_after":"1h 34m"},"date_kind":"incident","detection":null,"components":["model-routing","memory-limit"],"root_cause":"software-bug","remediation":[{"text":{"en":"limited incoming traffic","ko":"들어오는 트래픽을 제한했다."}},{"text":{"en":"redeployed the routing service en masse","ko":"서비스를 한꺼번에 재배포했다."}},{"text":{"en":"ramped traffic back up slowly","ko":"트래픽을 천천히 다시 올렸다."}}],"action_items":[{"text":{"en":"Pre-allocate the responseBuffer and reuse it instead of allocating a new one in a loop (3X improvement in memory and CPU usage)","ko":"루프에서 responseBuffer 를 매번 새로 할당하던 코드를 버퍼를 미리 할당해 재사용하도록 고쳤다. 배포 뒤 메모리와 CPU 사용량이 모두 3배 개선됐다."}},{"text":{"en":"Adjust the configured memory limits to an appropriate level so the service has significant headroom","ko":"설정된 메모리 한도를 알맞은 수준으로 조정해 서비스에 여유 용량을 넉넉히 확보했다."}},{"text":{"en":"Add rate limit controls to shed traffic more gracefully","ko":"트래픽을 더 매끄럽게 덜어 낼 수 있도록 rate limit 제어를 여러 가지 넣었다."}},{"text":{"en":"Increase the service's capacity","ko":"추가 예방책으로 서비스 용량을 늘렸다."}},{"text":{"en":"Change alerting to catch the underlying memory behaviour before it escalates into service issues","ko":"메모리 동작 이상이 서비스 문제로 커지기 전에 잡아내도록 여러 알림을 바꾼다."}},{"text":{"en":"Configure autoscaling for the service, which was not possible before because added capacity could hurt an upstream service","ko":"이 서비스에 오토스케일링을 설정한다. 용량을 늘리면 상위 서비스에 영향을 주던 문제를 바로잡았기 때문에 이제 설정할 수 있다."}}],"contributing":["no-alert-on-limit","no-spare-capacity"],"recurrence_of":null,"symptoms_text":{"en":"Between 5:42 AM and 7:16 AM PT on 8 November 2023 a large share of requests to OpenAI failed with 502 or 503 errors. Every model and API endpoint saw significant failures.\n\nNodes of the routing layer hit their memory limits and failed readiness checks. As more of them became unavailable, the remaining nodes did not have the capacity to serve incoming traffic, and the service could not recover on its own. That morning had dramatically more completions than any day before.","ko":"2023년 11월 8일 태평양 시각 오전 5시 42분부터 7시 16분까지 OpenAI 로 가는 요청 상당수가 502 나 503 오류로 실패했다. 모든 모델과 API 엔드포인트에서 실패가 크게 늘었다.\n\n라우팅 계층 노드가 메모리 한도에 걸리면서 레디니스 검사에 실패했다. 사용할 수 없는 노드가 늘어나 결국 들어오는 트래픽을 처리할 용량이 모자랐고, 서비스는 스스로 회복하지 못했다.\n\n그날 아침 completion 요청은 그전 어느 날보다 훨씬 많았다. OpenAI 는 이 요청 증가가 서비스를 무너뜨린 마지막 계기였다고 본다."},"updated_at":"2026-11-10T00:00:34.668421Z","url":"https://benchlet.com/incidentlib/app/cases/IL-0123","org_slug":"openai"}