[bug] Fetch rich media failed, blocked timeline for certain URLs #533

Open
opened 2023-05-05 03:19:18 +00:00 by nninja · 3 comments

Your setup

From source

Extra details

Debian 11

Version

2023.04

PostgreSQL version

13

What were you trying to do?

This could be related to the "home/public timeline" failed to load issues e.g. #487 #508

Several days ago, my instance's public timeline didn't load for all users. I deleted one post and timeline worked again.

The deleted post also wouldn't load in Admin-FE. Nothing special in the post, except an URL (NSFW): https://www.reinderdijkhuis.com/greyfriars/2022/11/12/nudist-conversation-enders/

In the screenshot below, I pasted the same URL in Akkoma-FE's compose field, with Preview opened. Note that the preview took forever to load, and eventually failed with a message, JSON.parse: unexpected character at line 1 column 1 of the JSON data

image

What did you expect to happen?

Fetching rich media doesn't block forever when JSON parse errors out

What actually happened?

No response

Logs

See screenshot above

Severity

I cannot use it as easily as I'd like

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Your setup From source ### Extra details Debian 11 ### Version 2023.04 ### PostgreSQL version 13 ### What were you trying to do? This could be related to the "home/public timeline" failed to load issues e.g. #487 #508 Several days ago, my instance's public timeline didn't load for all users. I deleted one post and timeline worked again. The deleted post also wouldn't load in Admin-FE. Nothing special in the post, except an URL (NSFW): https://www.reinderdijkhuis.com/greyfriars/2022/11/12/nudist-conversation-enders/ In the screenshot below, I pasted the same URL in Akkoma-FE's compose field, with Preview opened. Note that the preview took forever to load, and eventually failed with a message, `JSON.parse: unexpected character at line 1 column 1 of the JSON data` ![image](/attachments/95e64f3d-8dd5-46c8-8c35-d969711ef74b) ### What did you expect to happen? Fetching rich media doesn't block forever when JSON parse errors out ### What actually happened? _No response_ ### Logs ```shell See screenshot above ``` ### Severity I cannot use it as easily as I'd like ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
nninja added the
bug
label 2023-05-05 03:19:18 +00:00
Contributor

Had the same issue on my instance, finding the "faulty" toot was hard.
This issue can be concerning since legit users can toot bad links that can crash timelines for all users without even knowing.
Here the issue was caused by a bad redirect.

Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: ** (ArgumentError) scheme is required for url: wp-json/oembed/1.0/embedde4c.json?url=http%3A%2F%2Fdm1r.fr%2F
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (finch 0.14.0) lib/finch/request.ex:135: Finch.Request.parse_url/1
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (finch 0.14.0) lib/finch/request.ex:103: Finch.Request.build/5
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (tesla 1.4.4) lib/tesla/adapter/finch.ex:84: Tesla.Adapter.Finch.request/6
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (tesla 1.4.4) lib/tesla/adapter/finch.ex:63: Tesla.Adapter.Finch.call/2
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (tesla 1.4.4) lib/tesla/middleware/telemetry.ex:97: Tesla.Middleware.Telemetry.call/3
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (tesla 1.4.4) lib/tesla/middleware/follow_redirects.ex:46: Tesla.Middleware.FollowRedirects.redirect/3
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (pleroma 3.9.3-0-g8e7e2d9) lib/pleroma/web/rich_media/helpers.ex:84: Pleroma.Web.RichMedia.Helpers.rich_media_get/1
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     (pleroma 3.9.3-0-g8e7e2d9) lib/pleroma/web/rich_media/parsers/o_embed.ex:25: Pleroma.Web.RichMedia.Parsers.OEmbed.get_oembed_data/1    
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: Function: #Function<6.51738268/0 in Pleroma.Web.RichMedia.Parser.parse_with_timeout/1>
Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]:     Args: []

Had the same issue on my instance, finding the "faulty" toot was hard. This issue can be concerning since legit users can toot bad links that can crash timelines for all users without even knowing. Here the issue was caused by a bad redirect. ``` Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: ** (ArgumentError) scheme is required for url: wp-json/oembed/1.0/embedde4c.json?url=http%3A%2F%2Fdm1r.fr%2F Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (finch 0.14.0) lib/finch/request.ex:135: Finch.Request.parse_url/1 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (finch 0.14.0) lib/finch/request.ex:103: Finch.Request.build/5 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (tesla 1.4.4) lib/tesla/adapter/finch.ex:84: Tesla.Adapter.Finch.request/6 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (tesla 1.4.4) lib/tesla/adapter/finch.ex:63: Tesla.Adapter.Finch.call/2 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (tesla 1.4.4) lib/tesla/middleware/telemetry.ex:97: Tesla.Middleware.Telemetry.call/3 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (tesla 1.4.4) lib/tesla/middleware/follow_redirects.ex:46: Tesla.Middleware.FollowRedirects.redirect/3 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (pleroma 3.9.3-0-g8e7e2d9) lib/pleroma/web/rich_media/helpers.ex:84: Pleroma.Web.RichMedia.Helpers.rich_media_get/1 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: (pleroma 3.9.3-0-g8e7e2d9) lib/pleroma/web/rich_media/parsers/o_embed.ex:25: Pleroma.Web.RichMedia.Parsers.OEmbed.get_oembed_data/1 Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: Function: #Function<6.51738268/0 in Pleroma.Web.RichMedia.Parser.parse_with_timeout/1> Sep 22 09:27:58 NOM_HOTE_ANONYME docker[1723]: Args: [] ```

the above log is from an old version, please check if it occurs on the most recent release

the above log is from an old version, please check if it occurs on the most recent release
Contributor

Here is a log from v3.10.4 :)

[error] Task #PID<0.2385.0> started from #PID<0.2379.0> terminating
** (ArgumentError) scheme is required for url: wp-json/oembed/1.0/embedde4c.json?url=http%3A%2F%2Fdm1r.fr%2F
    (finch 0.16.0) lib/finch/request.ex:135: Finch.Request.parse_url/1
    (finch 0.16.0) lib/finch/request.ex:103: Finch.Request.build/5
    (tesla 1.7.0) lib/tesla/adapter/finch.ex:84: Tesla.Adapter.Finch.request/6
    (tesla 1.7.0) lib/tesla/adapter/finch.ex:63: Tesla.Adapter.Finch.call/2
    (tesla 1.7.0) lib/tesla/middleware/telemetry.ex:99: Tesla.Middleware.Telemetry.call/3
    (tesla 1.7.0) lib/tesla/middleware/follow_redirects.ex:46: Tesla.Middleware.FollowRedirects.redirect/3
    (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/helpers.ex:84: Pleroma.Web.RichMedia.Helpers.rich_media_get/1
    (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parsers/o_embed.ex:25: Pleroma.Web.RichMedia.Parsers.OEmbed.get_oembed_data/1
    (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parsers/o_embed.ex:9: Pleroma.Web.RichMedia.Parsers.OEmbed.parse/2
    (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parser.ex:161: anonymous fn/3 in Pleroma.Web.RichMedia.Parser.maybe_parse/1
    (elixir 1.14.0) lib/enum.ex:4751: Enumerable.List.reduce/3
    (elixir 1.14.0) lib/enum.ex:2514: Enum.reduce_while/3
    (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parser.ex:137: Pleroma.Web.RichMedia.Parser.parse_url/1
    (elixir 1.14.0) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
    (elixir 1.14.0) lib/task/supervised.ex:34: Task.Supervised.reply/4
    (stdlib 4.2) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Function: #Function<6.51738268/0 in Pleroma.Web.RichMedia.Parser.parse_with_timeout/1>

I mitigated the issue with this fix, but I'm absolutely not satisfied with it

80519fe492

Here is a log from v3.10.4 :) ``` [error] Task #PID<0.2385.0> started from #PID<0.2379.0> terminating ** (ArgumentError) scheme is required for url: wp-json/oembed/1.0/embedde4c.json?url=http%3A%2F%2Fdm1r.fr%2F (finch 0.16.0) lib/finch/request.ex:135: Finch.Request.parse_url/1 (finch 0.16.0) lib/finch/request.ex:103: Finch.Request.build/5 (tesla 1.7.0) lib/tesla/adapter/finch.ex:84: Tesla.Adapter.Finch.request/6 (tesla 1.7.0) lib/tesla/adapter/finch.ex:63: Tesla.Adapter.Finch.call/2 (tesla 1.7.0) lib/tesla/middleware/telemetry.ex:99: Tesla.Middleware.Telemetry.call/3 (tesla 1.7.0) lib/tesla/middleware/follow_redirects.ex:46: Tesla.Middleware.FollowRedirects.redirect/3 (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/helpers.ex:84: Pleroma.Web.RichMedia.Helpers.rich_media_get/1 (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parsers/o_embed.ex:25: Pleroma.Web.RichMedia.Parsers.OEmbed.get_oembed_data/1 (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parsers/o_embed.ex:9: Pleroma.Web.RichMedia.Parsers.OEmbed.parse/2 (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parser.ex:161: anonymous fn/3 in Pleroma.Web.RichMedia.Parser.maybe_parse/1 (elixir 1.14.0) lib/enum.ex:4751: Enumerable.List.reduce/3 (elixir 1.14.0) lib/enum.ex:2514: Enum.reduce_while/3 (pleroma 3.10.4-16-g3d17b943-upstream+dev) lib/pleroma/web/rich_media/parser.ex:137: Pleroma.Web.RichMedia.Parser.parse_url/1 (elixir 1.14.0) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2 (elixir 1.14.0) lib/task/supervised.ex:34: Task.Supervised.reply/4 (stdlib 4.2) proc_lib.erl:240: :proc_lib.init_p_do_apply/3 Function: #Function<6.51738268/0 in Pleroma.Web.RichMedia.Parser.parse_with_timeout/1> ``` I mitigated the issue with this fix, but I'm absolutely not satisfied with it https://github.com/BDX-town/Akkoma/commit/80519fe49232962c8fde2288942d56d3ed1b401d
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma#533
No description provided.