files_videoplayer icon indicating copy to clipboard operation
files_videoplayer copied to clipboard

Scrubbing through large video file keeps many PHP processes running, locks up server

Open abaart opened this issue 7 years ago • 7 comments

When you scrub through a large video file (in my case 6+ hrs, 70+GB), there are PHP processes that keep running on the server. Each process keeps reading out the file at a significant speed. However, new PHP processes are spawned on every change of position in the file. As the file is very large these processes keep running for a very long time. When i download the file and stop the download while in progress, there are no PHP processes that are running after stopping. Does the video player close the connection properly when seeking through the file? I am running Nextcloud on nginx with php-fpm 7.0.

Expected behaviour

Seeking/scrubbing a video file should not spawn (additional) PHP processes that keep running for a long time.

Actual behaviour

On every scrub/seek additional PHP processes are spawned, until the server-set maximum of processes is reached and the server becomes unresponsive.

Steps to reproduce

  1. Put large video file in Nextcloud.
  2. Play back file in browser.
  3. Open top/htop on server
  4. Seek through file several times
  5. Watch many PHP processes/workers run for a long time. (6. Keep seeking, server will become unresponsive as max. workers are running)

abaart avatar Oct 27 '17 13:10 abaart

Thanks for the report. I would guess that custom video players have a different scrubbing behavior compared to the browser's default HTML5 video player, so this could be an upstream problem. I'll look into it when I got some time.

Instagit avatar Nov 01 '17 09:11 Instagit

Thanks! I'm also not sure whether the cause of this problem is in the video player or in Nextcloud itself. For now I just disabled the videoplayer. This problem is also enabled by the very long timeout configured in PHP. On normal settings a runaway process will be terminated after 30 seconds or so. However, this causes problems when users download large files that take a long time to finish downloading.

abaart avatar Nov 01 '17 15:11 abaart

I have the same problem. The Server locks up and ends with a 502 bad gateway error

ghost avatar May 03 '18 20:05 ghost

Ok, I need to call in the server team here. :smile: I created a 93 GB test video file (concatenate the same video 100 times with ffmpeg) and tried to upload it. The upload never finished, but now I have 93 GB of file parts sitting in the uploads directory that can't be accessed from the Nextcloud UI. There seems to be a general problem with handling large files.

@nextcloud/server-triage

Instagit avatar May 04 '18 09:05 Instagit

The upload never finished, but now I have 93 GB of file parts sitting in the uploads directory that can't be accessed from the Nextcloud UI. There seems to be a general problem with handling large files.

This is cleaned up once on every login - see https://github.com/nextcloud/server/issues/8759

For the failed upload: please open a ticket in server with steps how to reproduce and potential logs.

MorrisJobke avatar May 04 '18 09:05 MorrisJobke

hello, same problem form me, when i seek more than 2 times on a 3Go video File, php die there is some investigation about this issue ?

just to motivate the devs: improve the video playback will allow you to win a large audience who use youtube / plex / emby etc...

fherbin avatar Sep 02 '19 14:09 fherbin

Any news? 1.5 GB seems to be enough, which makes the player pretty much unusable for any kind of phone video.

clawoflight avatar Sep 16 '19 08:09 clawoflight

I have the same problem. I already broke my head, I thought I had a problem with the server settings. But it turns out this is a common misfortune. When I play a video, I have www pool, and it is impossible to close them in any way except to close the video. I set a timeout of less than 120 seconds. At least php-fpm processes stop after this time, and earlier even after closing the file they continued to execute the video script. even turning off the video player in nextcloud does not help me, the files are still played.

Revvz avatar Oct 22 '19 10:10 Revvz