Project

General

Profile

Actions

Bug #1576

closed

Sometimes no HTTP error when file can't be opened

Added by admin about 16 years ago. Updated 2 months ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
-
ASK QUESTIONS IN Forums:
No

Description

Hi,

When Lighttpd is running out of FDs, sometimes it returns 500, sometimes it just closes the connection.
I've no idea why the behaviour isn't consistent.


accept(4, {sa_family=AF_INET, sin_port=htons(2591), sin_addr=inet_addr("192.168.1.34")}, [16]) = 1023
fcntl64(1023, F_SETFD, FD_CLOEXEC)      = 0
fcntl64(1023, F_SETFL, O_RDWR|O_NONBLOCK) = 0
ioctl(1023, FIONREAD, [44])             = 0
read(1023, "GET /xcc.tar.gz HTTP/1.0\r\nHost: xwis.net\r\n\r\n", 63) = 44
setsockopt(1023, SOL_TCP, TCP_CORK, [1], 4) = 0
writev(1023, [{"HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: application/octet-stream\r\nAcce"..., 188}], 1) = 188
open("/var/www/xcc.tar.gz", O_RDONLY|O_LARGEFILE) = -1 EMFILE (Too many open files)
write(5, "2008-02-28 10:43:28: (network_linux_sendfile.c.143) open failed:  Too many open "..., 87) = 87
setsockopt(1023, SOL_TCP, TCP_CORK, [0], 4) = 0
write(5, "2008-02-28 10:43:28: (connections.c.603) connection closed: write failed on fd 1"..., 85) = 85
close(1023)                             = 0

accept(4, {sa_family=AF_INET, sin_port=htons(2628), sin_addr=inet_addr("192.168.1.34")}, [16]) = 1023
fcntl64(1023, F_SETFD, FD_CLOEXEC)      = 0
fcntl64(1023, F_SETFL, O_RDWR|O_NONBLOCK) = 0
ioctl(1023, FIONREAD, [44])             = 0
read(1023, "GET /xcc.tar.gz HTTP/1.0\r\nHost: xwis.net\r\n\r\n", 63) = 44
stat64("/var/www/xcc.tar.gz", {st_mode=S_IFREG|0644, st_size=11426599, ...}) = 0
open("/var/www/xcc.tar.gz", O_RDONLY|O_LARGEFILE) = -1 EMFILE (Too many open files)
write(5, "2008-02-28 10:43:30: (response.c.537) file not found ... or so:  Too many open f"..., 102) = 102
setsockopt(1023, SOL_TCP, TCP_CORK, [1], 4) = 0
writev(1023, [{"HTTP/1.0 500 Internal Server Error\r\nConnection: close\r\nContent-Type: text/html\r\n"..., 165}, {"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD X"..., 369}], 2) = 534
setsockopt(1023, SOL_TCP, TCP_CORK, [0], 4) = 0
close(1023)       
Actions #1

Updated by admin about 16 years ago

Ah, it's probably related to stat caching. I think it should open the file before sending the headers, instead of the other way around.

Actions #2

Updated by stbuehler over 15 years ago

  • Status changed from New to Fixed
  • Resolution set to wontfix

I think everyone should just set their fd limit high enough; i don't see how we can fix this in a simple way for 1.4; 1.5 should handle EMFILE better.

Actions #3

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Wontfix
Actions #4

Updated by gstrauss 2 months ago

  • Description updated (diff)
  • Status changed from Wontfix to Fixed
  • Target version deleted (1.5.0)
  • ASK QUESTIONS IN Forums set to No

Fixed at least since lighttpd 1.4.56 and possibly earlier (not checked)

Static file to be sent is opened in http_response_send_file() prior to sending response headers.

Actions

Also available in: Atom