{"record":{"id":"b833e106029de47e","repo":"gravitational/teleport","slug":"no-more-ids-available","errorCode":null,"errorMessage":"no more IDs available","messagePattern":"no more IDs available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/srv/desktop/x11/xvfb.go","lineNumber":595,"sourceCode":"\t_, err = damage.QueryVersion(conn, 1, 1).Reply()\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\tif err := randr.Init(conn); err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\t_, err = randr.QueryVersion(conn, 5, 0).Reply()\n\tif err != nil {\n\t\treturn nil, nil, trace.Wrap(err)\n\t}\n\n\t// Initialize the XCMisc extension for ID re-use - if successful then hook in to xgb.\n\tif err = xcmisc.Init(conn); err == nil {\n\t\tconn.SetIDRangeFunc(func(c *xgb.Conn) (uint32, uint32, error) {\n\t\t\tidRange, err := xcmisc.GetXIDRange(c).Reply()\n\t\t\tif err != nil || (idRange.StartId == 0 && idRange.Count == 1) { // that range is out of XID\n\t\t\t\treturn 0, 1, errors.New(\"no more IDs available\")\n\t\t\t}\n\n\t\t\treturn idRange.StartId, idRange.Count, nil\n\t\t})\n\t}\n\n\tsuccess = true\n\treturn conn, setup, nil\n}\n\n// compositorPollFrames throttles compositor detection to roughly once per\n// second at the capture frame rate while still capturing the root window.\nconst compositorPollFrames = 25\n\n// refreshCaptureTarget detects whether a compositing window manager is active\n// and switches frame capture to the overlay window.\n// For non-compositing window managers (like Xfce) we keep capturing the root window.\nfunc (x *Backend) refreshCaptureTarget() error {","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/srv/desktop/x11/xvfb.go#L577-L613","documentation":"When XCMisc is available, xvfb code installs an xgb SetIDRangeFunc; if the queried XID range is exhausted (StartId==0, Count==1), it returns this error so xgb knows no more X resource IDs can be allocated. It surfaces as an xgb allocation failure.","triggerScenarios":"The X server has run out of X resource IDs: xcmisc.GetXIDRange reports an empty range while the xgb connection requests a new ID.","commonSituations":"Long-lived Xvfb sessions leaking windows/pixmaps until XIDs are exhausted; a single Xvfb display serving many desktop sessions; X server not restarted for long periods.","solutions":["Restart the Xvfb/X server process to reset the XID allocator","Fix ID leaks (destroy windows/pixmaps/contexts when sessions end)","Ensure XCMisc extension init is working so ID ranges are managed correctly","Monitor XID usage and recycle Xvfb instances before exhaustion"],"exampleFix":"// before\nid, err := conn.NewID() // errors: no more IDs available\n// after\nif xidsExhausted { restartXvfb() }\nid, err := conn.NewID()","handlingStrategy":"retry","validationCode":"// before heavy X resource use\nif range, err := xcmisc.GetXIDRange(conn).Reply(); err == nil && range.StartId == 0 && range.Count == 1 {\n    restartXvfb()\n}","typeGuard":null,"tryCatchPattern":"id, err := conn.NewID()\nif err != nil && strings.Contains(err.Error(), \"no more IDs available\") {\n    // recycle Xvfb and reconnect\n}","preventionTips":["Recycle Xvfb instances periodically in long-running fleets","Destroy X resources (windows, pixmaps) on session teardown","Monitor XID consumption via XCMisc ranges"],"tags":["x11","xvfb","resource-exhaustion"],"backgroundTag":"xid-exhaustion","analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}