¿Lighttpd no imprime errores para 500 en ninguna parte?

¿Lighttpd no imprime errores para 500 en ninguna parte?

Estoy intentando utilizar lighttpd como un servidor "activo" simple para algunos nodos que tengo en ejecución. Sin embargo, el script que estoy ejecutando arroja 500 errores de forma no determinista y no puedo encontrarlos por ningún lado.

Aquí está mi configuración de depuración:

server.document-root = "/var/www/health_checker"

server.port = 44445
server.modules += ("mod_auth", "mod_rewrite", "mod_accesslog", "mod_cgi", "mod_redirect", "mod_status" )

cgi.assign = ( ".sh" => "/bin/sh" )

url.rewrite-once = (
      "^/healthz"  => "/healthz.sh",
      "^/.*" => "/livez.sh" 
)

server.error-handler-404   = "/livez.sh"
server.errorlog            = "/home/aronchick/temperror.log"
server.breakagelog         = "/home/aronchick/tempcgi.log"
server.accesslog           = "/home/aronchick/tempaccess.log"

debug.log-request-header             = "enable"
debug.log-request-header-on-error    = "enable"
debug.log-response-header            = "enable"
debug.log-file-not-found             = "enable"
debug.log-request-handling           = "enable"
debug.log-condition-handling         = "enable"
debug.log-condition-cache-handling   = "enable"
debug.log-ssl-noise                  = "enable"
debug.log-timeouts                   = "enable"

Y aquí hay un ejemplo del no determinismo:

aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
{ 'hostname': 'myservice-vm-0.us-east4-c.c.myservice-production.internal', 'date': '2022-06-19 19:38:37.445066814+00:00', 'ip': 'xx.xx.xx.xx'}
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ 
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
{ 'hostname': 'myservice-vm-0.us-east4-c.c.myservice-production.internal', 'date': '2022-06-19 19:38:37.445066814+00:00', 'ip': 'xx.xx.xx.xx'}
aronchick@myservice-vm-0:~$ ps aux

Ni siquiera puedo entender dónde se escriben los errores 500. Aquí esta la /home/aronchick/temperror.log:

2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: GET / HTTP/1.1
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: Host: 127.0.0.1:44445
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: User-Agent: curl/7.81.0
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: Accept: */*
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: 
2022-06-19 19:29:37: (response.c.407) -- parsed Request-URI
2022-06-19 19:29:37: (response.c.409) Request-URI     : /
2022-06-19 19:29:37: (response.c.411) URI-scheme      : http
2022-06-19 19:29:37: (response.c.413) URI-authority   : 127.0.0.1:44445
2022-06-19 19:29:37: (response.c.415) URI-path (clean): /
2022-06-19 19:29:37: (response.c.417) URI-query       : 
2022-06-19 19:29:37: (response.c.407) -- parsed Request-URI
2022-06-19 19:29:37: (response.c.409) Request-URI     : /livez.sh
2022-06-19 19:29:37: (response.c.411) URI-scheme      : http
2022-06-19 19:29:37: (response.c.413) URI-authority   : 127.0.0.1:44445
2022-06-19 19:29:37: (response.c.415) URI-path (clean): /livez.sh
2022-06-19 19:29:37: (response.c.417) URI-query       : 
2022-06-19 19:29:37: (response.c.495) -- logical -> physical
2022-06-19 19:29:37: (response.c.497) Doc-Root     : /var/www/health_checker
2022-06-19 19:29:37: (response.c.499) Basedir      : /var/www/health_checker
2022-06-19 19:29:37: (response.c.501) Rel-Path     : /livez.sh
2022-06-19 19:29:37: (response.c.503) Path         : /var/www/health_checker/livez.sh
2022-06-19 19:29:37: (response.c.522) -- handling subrequest
2022-06-19 19:29:37: (response.c.524) Path         : /var/www/health_checker/livez.sh
2022-06-19 19:29:37: (response.c.526) URI          : /livez.sh
2022-06-19 19:29:37: (response.c.528) Pathinfo     : 
2022-06-19 19:29:37: (response.c.164) fd:8 resp: HTTP/1.1 500 Internal Server Error
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Content-Type: text/html
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Content-Length: 365
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Date: Sun, 19 Jun 2022 19:29:37 GMT
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Server: lighttpd/1.4.63
2022-06-19 19:29:37: (response.c.164) fd:8 resp: 

Respuesta1

Si su script no devuelve una respuesta, lighttpd devuelve 500 Error interno del servidor.

El script CGI probablemente no sigue lasespecificación CGI.

? ¿Su script CGI hace algo como:

printf "Status: 200\nContent-Type: application/json\n\n"

antes de imprimir { 'hostname': 'myservice-vm-0.us-east4-c.c.myservice-production.internal', 'date': '2022-06-19 19:38:37.445066814+00:00', 'ip': 'xx.xx.xx.xx'}?

información relacionada