Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
13.07k stars 1.51k forks source link

Import video fail after cancel #1177

Closed Pofilo closed 5 years ago

Pofilo commented 6 years ago

In video imports, when an import fails, all four columns should be filled and a little arrow allows us to see more about the error.

One time, I made an import and tried to cancel it and it failed. It looks like the database was not filled correctly so the columns are shifted as shown in this image:

image

Is there a way to fix the database (aka removing this line) with a script or by hand ? I f there is one, I can use it to clean my instance and I could try to reproduce the thing (import a video and cancel it).

Chocobozzz commented 6 years ago

Please copy the related row so I can reproduce (in the videoImport table)

Pofilo commented 6 years ago

I'm not using PostgreSQL so much, tell me if I'm doing wrong:

And then, I do my select * from videoImport; and the result is:

ERROR:  relation "videoimport" does not exist
LINE 1: select * from videoImport;

Why does my relation is transformed to videoimport instead of videoImport ?

Sorry for my noobyness about PostgreSQL :/

Chocobozzz commented 6 years ago

SELECT * FROM "videoImport";

Pofilo commented 6 years ago

I give you both lines, the first one is the one with the error:

 id |                                  targetUrl                                   | magnetUri | torrentName | state |           error           | userId | videoId |         createdAt          |         updatedAt
----+------------------------------------------------------------------------------+-----------+-------------+-------+---------------------------+--------+---------+----------------------------+----------------------------
  1 | https://peertube.waifus.eu/videos/watch/217eefeb-883d-45be-b7fc-a788ad8507d3 |           |             |     2 |                           |      2 |         | 2018-09-01 23:42:55.41+02  | 2018-09-01 23:43:26.405+02
  2 | https://peertube.waifus.eu/videos/watch/217eefeb-883d-45be-b7fc-a788ad8507d3 |           |             |     2 |                           |      2 |     299 | 2018-09-01 23:45:55.506+02 | 2018-09-01 23:46:26.101+02

So the videoId is missing but the state is at 2.

I'll make some tries to reproduce the bug.

Pofilo commented 6 years ago

If we don't succeed to reproduce it, as it appears in peertube-v1.0.0-beta.11, we may believe it has been fixed since as some works has be done to imports.

To anyone having this problem, delete the line with: delete from "videoImport" where id = 1

McFlat commented 6 years ago

There is also an error in video import script where if youtube-dl returns an error because the video can't be downloaded the rest of the videos don't get imported, what we should do is continue on error, or rather use the youtube-dl flag --ignore-errors

here is the output of the error I get when a video can't be imported the rest of the video don't import either. We should catch the promise error and also use the --ignore-errors flag.


(node:21561) UnhandledPromiseRejectionWarning: Error: Command failed: /var/www/peertube/versions/peertube-v1.0.0-beta.15/node_modules/youtube-dl/bin/youtube-dl --dump-json -f best http://www.youtube.com/watch?v=DLBcFVbUs_0
ERROR: This video contains content from kaze, who has blocked it in your country on copyright grounds.

    at ChildProcess.exithandler (child_process.js:276:12)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:21561) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (re$
(node:21561) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
McFlat commented 6 years ago

I'm gonna try to solve this and make a pull request

Chocobozzz commented 5 years ago

Closing this issue: the origin issue seems to have been fixed.