evazion
48ecb80d6b
Fix #5230 : video upload 500 error (StatementInvalid) & empty error panel on page
...
Fix StatementInvalid exception when uploading https://files.catbox.moe/vxoe2p.mp4 .
This was a result of multiple bugs:
* First, generating thumbnails for the video failed. This was because
the video uses the AV1 codec, which FFmpeg failed to decode. It failed
because our version of FFmpeg was built without the `--enable-libdav1d`
flag, so it uses the builtin AV1 decoder, which apparently can't
handle this particular video (it spews a bunch of errors about "Failed
to get pixel format" and "missing sequence header" and "failed to get
reference frame").
* Because generating the thumbnails failed, an exception was raised. We
tried to save the error message in the upload_media_assets.error
field. However, this also failed because the error message was 77kb
long (it contained the entire output of the ffmpeg command), but the
`upload_media_assets` table had a btree index on the `error` column,
which meant the maximum length of the error column was limited to
~2.7kb. This lead to a StatementInvalid exception being raised.
* Because the StatementInvalid exception was raised while we were trying
to set the upload media asset's status to `failed`, the upload was
left stuck in the `processing` state rather than being set to the
`failed` state.
* Because the upload was stuck in the `processing` state, the upload
page would hang forever waiting for the upload to complete.
The fixes are to:
* Build FFmpeg with `--enable-libdav1d` to use libdav1d for decoding AV1
videos instead of the builtin AV1 decoder.
* Remove the index on the `upload_media_assets.error` column so that
setting overly long error messages won't fail.
* Catch unexpected exceptions in ProcessUploadMediaAssetJob so we can
mark uploads as failed, even if `process_upload!` itself fails because
it raises an unexpected exception inside its own exception handler.
* Check that the video is playable with `MediaFile::Video#is_corrupt?` before
allowing it to be uploaded. This way we can return a better error
message if we can't generate thumbnails because the video isn't
playable. This requires decoding the entire video, so it means uploads
may take several seconds longer for long videos. It's also a security
risk in case ffmpeg has any bugs.
* Define `MediaAsset#preview!` as raising an exception on error, so
it's clear that generating thumbnails can fail. Define `MediaAsset#preview`
as returning nil on error for when we don't care about the cause of
the error.
2022-10-26 22:49:55 -05:00
..
2018-04-26 15:31:06 -07:00
2021-10-14 02:41:44 -05:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2021-10-08 21:26:42 -05:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2022-02-28 20:27:11 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2020-03-18 03:32:40 -05:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2021-03-05 16:00:54 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2019-12-22 21:23:37 -06:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2018-04-26 15:31:06 -07:00
2019-12-22 21:23:37 -06:00
2018-04-06 18:09:57 -07:00
2019-12-22 21:23:37 -06:00
2018-04-06 18:09:57 -07:00
2018-04-06 18:09:57 -07:00
2018-04-06 18:09:57 -07:00
2018-04-06 18:09:57 -07:00
2018-04-26 15:31:06 -07:00
2018-04-06 18:09:57 -07:00
2018-04-26 15:31:06 -07:00
2018-04-25 14:31:11 -07:00
2022-02-28 20:27:11 -06:00
2018-06-14 17:52:41 -07:00
2018-06-14 17:52:41 -07:00
2018-08-04 16:32:15 -07:00
2018-08-24 12:10:51 -07:00
2018-09-12 15:19:27 -07:00
2018-09-13 11:44:11 -07:00
2022-02-28 20:27:11 -06:00
2018-11-08 15:09:31 -06:00
2018-11-08 14:24:45 -08:00
2018-11-13 19:18:11 -06:00
2018-12-10 17:51:57 -08:00
2018-12-10 17:51:57 -08:00
2018-11-28 13:55:02 -08:00
2018-11-29 16:51:46 -08:00
2018-12-02 11:45:57 -06:00
2019-01-09 16:20:34 -06:00
2019-01-28 17:23:33 -08:00
2019-07-12 10:48:48 -07:00
2019-08-27 18:13:30 -05:00
2019-08-27 18:13:30 -05:00
2019-08-27 18:45:40 -05:00
2019-08-27 18:48:48 -05:00
2019-08-27 19:58:05 -05:00
2019-08-29 00:52:23 -05:00
2019-08-29 02:06:35 -05:00
2019-09-02 18:53:27 -05:00
2019-09-07 22:21:55 -05:00
2019-09-07 23:06:20 -05:00
2019-09-19 13:20:06 -05:00
2019-09-23 02:22:54 -05:00
2019-09-25 21:43:01 -05:00
2019-10-23 21:36:48 -05:00
2019-10-24 19:48:30 -05:00
2019-11-11 21:03:07 -06:00
2019-11-11 21:03:07 -06:00
2019-11-15 22:44:13 -06:00
2019-11-15 22:44:22 -06:00
2019-11-16 19:34:30 -06:00
2019-11-17 01:52:36 -06:00
2019-11-17 02:10:24 -06:00
2019-11-17 02:45:28 -06:00
2019-11-17 14:39:41 -06:00
2019-11-19 00:13:24 -06:00
2019-12-23 00:02:54 -06:00
2020-01-16 21:40:14 +00:00
2020-01-17 00:19:20 -06:00
2020-01-18 06:40:20 +00:00
2020-01-17 22:24:29 -06:00
2020-01-21 00:10:20 -06:00
2020-01-21 00:10:21 -06:00
2020-01-27 00:47:35 -06:00
2020-02-16 23:09:00 -06:00
2020-02-22 22:37:36 -06:00
2020-02-23 17:52:38 -06:00
2020-03-06 14:50:21 -06:00
2020-03-06 23:23:38 -06:00
2020-03-08 23:18:15 -05:00
2020-03-12 21:18:53 -05:00
2020-03-20 16:08:20 -05:00
2020-03-25 18:48:21 -05:00
2020-03-25 18:48:42 -05:00
2020-04-03 23:44:02 -05:00
2020-04-06 14:13:22 -05:00
2020-04-27 19:11:47 -05:00
2020-08-06 20:55:45 -05:00
2020-08-16 14:31:47 -05:00
2020-12-01 18:58:45 -06:00
2020-12-13 04:10:48 -06:00
2020-12-19 14:26:07 -06:00
2020-12-24 21:15:04 -06:00
2021-01-06 16:05:56 -06:00
2021-01-08 22:34:37 -06:00
2021-01-08 22:34:37 -06:00
2021-01-08 22:34:37 -06:00
2021-01-12 13:12:33 -06:00
2021-01-10 03:35:12 -06:00
2021-01-15 02:03:54 -06:00
2021-01-23 14:44:11 -06:00
2021-01-26 19:19:20 -06:00
2021-01-26 19:24:18 -06:00
2021-02-14 04:09:47 -06:00
2021-02-14 21:02:07 -06:00
2021-03-05 16:00:54 -06:00
2021-03-11 02:59:58 -06:00
2021-03-30 00:10:22 -05:00
2021-03-30 04:52:01 -05:00
2021-09-02 06:07:52 -05:00
2021-09-08 05:00:54 -05:00
2021-09-21 12:35:46 -05:00
2021-09-21 12:35:46 -05:00
2021-09-26 07:45:29 -05:00
2021-09-26 08:06:13 -05:00
2021-10-08 21:26:42 -05:00
2021-10-10 17:45:19 -05:00
2021-10-11 03:34:47 -05:00
2021-10-12 20:22:00 -05:00
2021-10-14 02:41:44 -05:00
2021-10-16 07:44:27 -05:00
2021-10-18 00:34:24 -05:00
2021-10-18 05:18:46 -05:00
2021-10-24 04:35:06 -05:00
2021-11-21 02:36:30 -06:00
2022-01-02 17:13:41 -06:00
2022-01-04 15:58:12 -06:00
2022-01-06 11:25:51 -06:00
2022-01-06 11:39:18 -06:00
2022-01-06 20:03:50 -06:00
2022-01-09 11:01:00 -06:00
2022-01-09 11:01:00 -06:00
2022-01-10 11:32:59 -06:00
2022-01-10 11:32:59 -06:00
2022-01-10 11:32:59 -06:00
2022-01-10 11:32:59 -06:00
2022-01-20 20:50:23 -06:00
2022-01-25 16:10:53 -06:00
2022-02-03 14:07:09 -06:00
2022-02-04 02:19:30 -06:00
2022-02-07 15:44:39 -06:00
2022-02-10 12:06:57 -06:00
2022-02-11 02:49:52 -06:00
2022-02-28 20:27:11 -06:00
2022-03-18 04:00:16 -05:00
2022-04-02 23:30:39 -05:00
2022-04-03 17:08:36 -05:00
2022-04-08 09:07:14 +02:00
2022-04-10 00:07:15 -05:00
2022-05-04 23:19:53 -05:00
2022-05-15 01:05:24 -05:00
2022-06-01 18:31:46 -05:00
2022-06-24 04:54:26 -05:00
2022-08-21 20:10:47 -05:00
2022-09-01 23:54:07 -05:00
2022-09-09 15:58:48 -05:00
2022-09-11 17:35:53 -05:00
2022-09-15 03:47:05 -05:00
2022-09-16 04:20:19 -05:00
2022-09-17 21:32:26 -05:00
2022-09-17 23:30:13 -05:00
2022-09-18 23:31:30 -05:00
2022-09-20 20:58:10 -05:00
2022-09-20 21:26:47 -05:00
2022-09-22 01:48:21 -05:00
2022-09-22 20:17:57 -05:00
2022-09-24 20:12:41 -05:00
2022-09-25 00:03:52 -05:00
2022-09-26 03:24:50 -05:00
2022-10-06 23:16:29 -05:00
2022-10-10 02:57:23 -05:00
2022-10-26 04:15:37 -05:00
2022-10-26 04:15:37 -05:00
2022-10-26 22:49:55 -05:00