Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2430 closed patch (fixed)

UPnP sendfile64 returns Invalid argument error.

Reported by: MTisza@… Owned by: dblain
Priority: minor Milestone: unknown
Component: mythtv Version: 0.20
Severity: medium Keywords: UPnP, sendfile, sendfile64, httprequest
Cc: Ticket locked: no

Description

Line 287 of httrequest.cpp uses sendfile64 to send the files out to the UPnP/http client. I narrowed down my probelm to that call, and changed it as such to find the error message:

if (sendfile64( getSocketHandle(), file, &offset, llSize ) < 0 ) {

perror("Error sending file: ");

}

After that I can see: 2006-09-20 06:33:47.977 HttpWorkerThread::ProcessWork:Begin( -1394639952 ) socket=15 Error sending file: : Invalid argument 2006-09-20 06:33:47.987 HttpWorkerThread::ProcessWork:End( -1394639952 )

This only happens on some files. At first I thought it was only & all large files. After some additional testing I can see a file that's 5.8GB so that's out I think. All my files are recorded OTA/ATSC/HD. They play fine locally, but not via UPnP. My troublshooting included a complete reinstall of the OS, from ubuntu at first to kubuntu. Both were dapper drake releases.

Attachments (1)

httprequest.cpp.diff (653 bytes) - added by troycauble@… 14 years ago.
single file patch

Download all attachments as: .zip

Change History (9)

comment:1 Changed 14 years ago by MTisza@…

I'll just add the fact that the arguments do appear to be valid as far as I can tell. The file and stream descriptor are 15 & 14 most of the time (this obviously changes now and then). The offset is always 0, and the files size is a match with what ls -la gives me for the corresponding file. I verified this before and after the call to sendfile64. Is there a better replacement to the sendfile64 call?

comment:2 Changed 14 years ago by Isaac Richards

Priority: majorminor

comment:3 Changed 14 years ago by anonymous

This should be major. Video files aren't served.

comment:4 Changed 14 years ago by MTisza@…

For the time being I was able to hard code some changes that tell the client to stream the files from another server which in my case was an apache 2.2.3 server on the same machine. That works beautifully, but it's a real kloodge. Anonymous, have you been able to duplicate this problem exactly?

Changed 14 years ago by troycauble@…

Attachment: httprequest.cpp.diff added

single file patch

comment:5 Changed 14 years ago by troycauble@…

Type: defectpatch

Attached patch fixes the bug. Basically sendfile takes up to INT_MAX bytes and doesn't guarantee to write them all.

comment:6 Changed 14 years ago by dblain

Owner: changed from Isaac Richards to dblain

comment:7 Changed 14 years ago by dblain

Resolution: fixed
Status: newclosed

comment:8 Changed 14 years ago by dblain

(In [11304]) fixes #2430

Fixes issue where sendfile64 returns without sending all data.

Also, added Date: to the response http header.

Note: See TracTickets for help on using tickets.