"Bad file descriptor" in zmcontrol

Forum for questions and support relating to the 1.25.x releases only.
Locked
dma_k
Posts: 27
Joined: Sat Jan 19, 2013 5:58 pm

"Bad file descriptor" in zmcontrol

Post by dma_k »

Dear all,

Please help me with the following problem. On some reason LWP in control module Foscam.pm is failing with "Bad file descriptor" when command is about to be send over HTTP.

syslog:

Code: Select all

16:15:00 zmcontrol[20060]: INF [Error check failed:'500 Can't connect to 192.168.1.110:80 (connect: Bad file descriptor)]
strace:

Code: Select all

socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(4, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.110")}, 16) = -1 EINPROGRESS (Operation now in progress)
fcntl64(4, F_GETFL)                     = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(4, F_SETFL, O_RDWR)             = 0
close(4)                                = 0
I have written a tiny program that sends the same request with LWP and it works fine. The camera is rotated.
strace:

Code: Select all

socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.110")}, 16) = -1 EINPROGRESS (Operation now in progress)
select(8, NULL, [3], NULL, {180, 0})    = 1 (out [3], left {179, 980022})
connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.110")}, 16) = 0
write(3, "GET /decoder_control.cgi?command"..., 176) = 176
read(3, "HTTP/1.1 200 OK\r\nServer: Netwave"..., 1024) = 176
It looks like $!{EINPROGRESS} variable is reset just after connect() returns in IO::Socket (line 114). I might be completely misled.

The problem is not always reproducible. Sometimes the command is passed through.

Can somebody give me a hint where to look at? As the script forks, I cannot do perl -wTd:Trace /usr/bin/zmcontrol.pl ... If somebody knows if it is possible to connect to running script, please let me know.

Debian sid, kernel 3.2.0-3-486, Perl v5.14.2.
Locked