Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dancer randomly hangs when reading GET request

I am playing with perl dancer on Linux and all is nice and dany if the browser connects to the server directly via LAN. However, when I connect via WAN and the browser is IE9, then occasionally the busy cursor won't go away.

I can provoke this, by reloading the page apx 10 times in a row. I get this problem even when I wait severall seconds between each reload. The page itself is awfully simply and passes the w3c check.

It makes no difference if I run dancer as root, or whether the port is 80 or 3000. A also tested frequent reloading of a page with apache and there does not seem to be an issue.

I ran strace and I have the impression, that the request data is sometimes not availbale at the the time dancer tries to read it. This is what the trace looks like

When it works:

{sa_family=AF_INET, sin_port=htons(52073), sin_addr=inet_addr("78.42.213.92")}, [16]) = 4
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfab5028) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(4, 0, 0xbfab5070, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfab5028) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(4, 0, 0xbfab5070, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
getpeername(4, {sa_family=AF_INET, sin_port=htons(52073), sin_addr=inet_addr("78.42.213.92")}, [16]) = 0
read(4, "G", 1)                         = 1
read(4, "E", 1)                         = 1
read(4, "T", 1)                         = 1

When it hangs

{sa_family=AF_INET, sin_port=htons(52225), sin_addr=inet_addr("78.42.213.92")}, [16]) = 4
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfab5028) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(4, 0, 0xbfab5070, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfab5028) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(4, 0, 0xbfab5070, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
getpeername(4, {sa_family=AF_INET, sin_port=htons(52225), sin_addr=inet_addr("78.42.213.92")}, [16]) = 0
read(4, 

and then it sits forever. Any Idea what I can do?

like image 615
Martin Drautzburg Avatar asked Oct 04 '22 10:10

Martin Drautzburg


1 Answers

I ran into a similar problem with IE9 connecting to a Catalyst dev server. Eric Lawrence (IE Team Lead!?) suggested it might be due to IE9's background connection feature. IE9 opens a background TCP connection to speed up future requests to the server, but this obviously causes problems for single threaded servers. If you're running Dancer's default dev server (HTTP::Server::Simple::PSGI), you won't be able to handle IE9.

I worked around it by proxying from Apache. It makes dev a little more of a hassle, but only when I have to test IE9.

like image 99
wes Avatar answered Oct 13 '22 10:10

wes