{"record":{"id":"0bfbf6ce2d1bc91b","repo":"nginx/nginx","slug":"ngx-log-emerg-0bfbf6","errorCode":"NGX_LOG_EMERG","errorMessage":"gethostname() failed","messagePattern":"gethostname\\(\\) failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/ngx_cycle.c","lineNumber":208,"sourceCode":"        ngx_destroy_pool(pool);\n        return NULL;\n    }\n\n    ngx_memzero(cycle->listening.elts, n * sizeof(ngx_listening_t));\n\n\n    ngx_queue_init(&cycle->reusable_connections_queue);\n\n\n    cycle->conf_ctx = ngx_pcalloc(pool, ngx_max_module * sizeof(void *));\n    if (cycle->conf_ctx == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n\n\n    if (gethostname(hostname, NGX_MAXHOSTNAMELEN) == -1) {\n        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, \"gethostname() failed\");\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n\n    /* on Linux gethostname() silently truncates name that does not fit */\n\n    hostname[NGX_MAXHOSTNAMELEN - 1] = '\\0';\n    cycle->hostname.len = ngx_strlen(hostname);\n\n    cycle->hostname.data = ngx_pnalloc(pool, cycle->hostname.len);\n    if (cycle->hostname.data == NULL) {\n        ngx_destroy_pool(pool);\n        return NULL;\n    }\n\n    ngx_strlow(cycle->hostname.data, (u_char *) hostname, cycle->hostname.len);\n\n","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/nginx/nginx/blob/3f6f7824d4e2eb1ac37dec76683d525ac0ff521c/src/core/ngx_cycle.c#L190-L226","documentation":"Error \"gethostname() failed\" thrown in nginx/nginx.","triggerScenarios":"Thrown at src/core/ngx_cycle.c:208 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f6f7824d4e2eb1ac37dec76683d525ac0ff521c","analyzedAt":"2026-08-22T03:09:46.447Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}