Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Status Format Results in 500 Error #219

Open
DeadSuperHero opened this issue Feb 24, 2025 · 2 comments
Open

Adding Status Format Results in 500 Error #219

DeadSuperHero opened this issue Feb 24, 2025 · 2 comments

Comments

@DeadSuperHero
Copy link

Branching off from #188

What: When configuring clients, including the Status post format results in a 500 error. Tested with Phanpy and Moshidon, both clients fail to load timelines and display 500 errors when trying to access the API.

Some logging output:

-- Request at 2025-02-22T22:28:30.973Z
GET /api/v1/accounts/1/statuses
Server: https://wedistribute.org
Authorization: Bearer 3929ed1be6ef980d189e5a4a3a4149d83691732e
Content-Type: application/json
Accept: application/json
-- Response received after 0.9 seconds
HTTP Status: 200
access-control-allow-headers: Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type
access-control-expose-headers: X-WP-Total, X-WP-TotalPages, Link
allow: GET, OPTIONS
connection: keep-alive
content-type: application/json; charset=UTF-8
date: Sat, 22 Feb 2025 22:28:31 GMT
link: <https://wedistribute.org/wp-json/>; rel="https://api.w.org/"
server: nginx/1.18.0 (Ubuntu)
transfer-encoding: chunked
vary: accept, content-type, Origin
x-cache: bypass
x-content-type-options: nosniff
x-robots-tag: noindex
[]
-- Request at 2025-02-22T22:28:29.978Z
GET /api/v1/timelines/home
Server: https://wedistribute.org
Authorization: Bearer 3929ed1be6ef980d189e5a4a3a4149d83691732e
Content-Type: application/json
Accept: application/json
-- Response received after 7.8 seconds
HTTP Status: 500
access-control-allow-credentials: true
access-control-allow-headers: content-type, authorization
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: X-WP-Total, X-WP-TotalPages, Link
cache-control: no-cache, must-revalidate, max-age=0, no-store, private
connection: keep-alive
content-type: application/json; charset=UTF-8
date: Sat, 22 Feb 2025 22:28:37 GMT
expires: Wed, 11 Jan 1984 05:00:00 GMT
link: <https://wedistribute.org/wp-json/>; rel="https://api.w.org/"
server: nginx/1.18.0 (Ubuntu)
transfer-encoding: chunked
vary: accept, content-type
x-cache: bypass
x-content-type-options: nosniff
x-robots-tag: noindex
{
  "code": "internal_server_error",
  "message": "<p>There has been a critical error on this website.</p><p><a href=\"https://wordpress.org/documentation/article/faq-troubleshooting/\">Learn more about troubleshooting WordPress.</a></p>",
  "data": {
    "status": 500,
    "error": {
      "type": 1,
      "message": "Allowed memory size of 134217728 bytes exhausted (tried to allocate 10486016 bytes)",
      "file": "/var/www/wordpress/wp-content/object-cache.php",
      "line": 1295
    }
  },
  "additional_errors": []
}
-- Request at 2025-02-22T22:28:27.522Z
GET /api/v1/timelines/home
Server: https://wedistribute.org
Authorization: Bearer 3929ed1be6ef980d189e5a4a3a4149d83691732e
Content-Type: application/json
Accept: application/json
!! Response received after 5.5 seconds
HTTP Status: 502
connection: keep-alive
content-length: 166
content-type: text/html
date: Sat, 22 Feb 2025 22:28:33 GMT
server: nginx/1.18.0 (Ubuntu)
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
-- Page loaded at 2025-02-22T22:28:23.573Z

The reason this is important is that our earlier experiments with EMA had a Notes post type of the Status post format, and those no longer seem to work. Porting that data to use the Mastodon Status post type and Standard post format is relatively trivial, but the break is a little bit concerning, as it raises questions as to what the "correct" defaults should be when utilizing EMA for our own needs.

@akirk
Copy link
Owner

akirk commented Feb 24, 2025

It should not break, I use it with the post format status personally. Can you check the server-side if there is a PHP fatal error?

@akirk
Copy link
Owner

akirk commented Feb 24, 2025

Could you try in the Mastodon API tester with /api/v1/timelines/home?limit=10 or /api/v1/timelines/home?limit=2 to see if the memory exhaustion can be prevented?

I think a measure might be to add a setting to arbitrarily limit the amount of items the client can request (currently it's 30 by default). If it requests too many items at once there is a higher chaunce of memory exhaustion and that way it could be limited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants