Closed feelfreelinux closed 7 years ago
When you refer to "seek quickly", do you mean that the client is sending lots of requests with Content-Range
set and QHttpEngine is crashing? Is there any chance you could run this in a debugger and pinpoint where the crash is occurring? If you are able to provide a simple reproducible example, that would be extremely helpful.
@nathan-osman Used fileserver example from examples directory, played video in format MPEG-4 .mp4. Code seems to crash somewhere in QTcpServer, can't get any debuger output directly in signals/etc. Fail is pretty random, even happened on first play. Yes, I reffer to Content-Range requestd
Okay, I'll see if I can reproduce the crash then.
Sorry, two more questions :smile:
master
from Git?)@nathan-osman Using master branch, 0.1.0 does not support seeking. Using ubuntu 14.04.
@InfernoCoder - can also approve this.
Yep, this bug occurs on my system too. Another segmentation error occurs when I run a video which has higher resolution than supported on my PC. For example, if I run a 4K video on my 1080p PC, the server crashes. Tried on Google Chrome and VLC Player. I'm also running Debian.
@nathan-osman Happens really often when trying to launch video in google chrome. Segmentation faults often happens, when there is mess with pointers/etc.
@nathan-osman @feelfreelinux I have been able to find a workaround by commenting out the socket->close();
line in qfilesystemhandler.cpp
I'll take another look at that section.
I have finally determined the source of the problem and it's quite subtle:
In ServerPrivate::process()
, the new socket's disconnected()
signal is connected to deleteLater()
. At some point after requesting the file, Chrome sends a TCP RST packet, closing the connection. This of course triggers the socket's destructor. Meanwhile, in FilesystemHandlerPrivate::processFile()
, the QIODeviceCopier
completes and finished()
is emitted. Connected to this is a lambda that runs socket->close()
which triggers a segmentation fault (SIGSEGV) since the socket was already destroyed.
The correct solution, I believe, is to remove the connection between Socket::disconnected()
and Socket::deleteLater()
since this should be handled by the handlers rather than the server itself. I have confirmed that removing this line eliminates the crash. I'll be working on pushing a fix for this shortly.
I believe this is now fixed. Please let me know if the issue has been resolved.
When I try to seek quickly, multiple times using QHttpFilesystemHandler, app crashes with "Segmentation fault".