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

Friends 2.7.6 without Post Kinds leads to segfault when accessing admin area with status/reposted Mastodon status #249

Open
nafnlj opened this issue Sep 7, 2023 · 12 comments

Comments

@nafnlj
Copy link

nafnlj commented Sep 7, 2023

This issue pertains to Friends version 2.7.6.
I am running WordPress-Developer as a Cloudron app on a VPS server.

Quick Summary

(added after receiving advice that I should have a quick summary)

  • I experience a seg fault when I enter admin posts area with (1) a status format post or repost from ActivityPub to Friends (2) with Friends enabled and (3) with Post Kinds disabled. Tested using SemPress and Twenty Twenty-Three.
  • Steps to reproduce: (1) Have a status format post in posts; (2) Have Friends enabled and Post Kinds disabled; and (3) Try to enter WP Admin menu.
  • Expected outcome: I should be able to enter my posts menu regardless of status of the status of Friends or Post Kinds.
  • Impact: From the perspective of someone looking to use both Friends and Post Kinds, the issue creates a hard dependency on Post Kinds to use Friends with my set-up. While that is my plan for now, I would not want to be that dependent on any plugin.
  • Other notes: (1) It works with Friends and Post Kinds disabled. (2) Post Kinds papers over the issue I have with Friends and the post. (3) I manage my WordPress install with Cloudron so I took advantage of Cloudron's GUI tools to track console output. (4) Other notes and details about my set-up and what I tested are below.

Overview

  • Initially using SemPress with lightly modified child theme and Friends plugin (note: I am using SemPress from the WP themes repo, not the version on GitHub)
    • Also tested with unmodified SemPress and had the same issue
    • Also tested with Automonie and had same issue
    • Finally, tested with Twenty Twenty-Three and also had the issue, so it does not seem to be related to the SemPress family specifically -- which is why I am raising it here
  • Create post with format "Status" or boosted post from Mastodon via Activity Pub + Friends
  • Attempt to go into Posts from editor
  • 502 error on /edit.php
  • If "Status" post is in Trash, I can access the regular list of posts but trying to enter Trashed posts returns error
  • This error does not occur when Post Kinds plugin is active but when Post Kinds is inactive, error occurs
  • Error also occurs if I have a post from Friends plugin where I either reblogged or replied to a Mastodon post
  • I tested with Automonie out of curiosity and had the same issue. Note in that case the Social format icon does appear next to draft post but I have the same 502 error in the WordPress admin as with SemPress.

Console output

The following tests were performed under the following conditions:

  1. SemPress Child/Parent theme active
  2. Four published posts in Admin > Posts
  3. One of the four posts is a repost of an ActivityPub post made using Friends + AP
  4. I confirmed the first three posts make no difference -- I can always access Posts regardless of config (with Kinds they are Note/Reply/Note)

I viewed my logs through Cloudron's UI while triggering the error by entering Admin > Posts with an offending post, Friends installed, and Post Kinds deactivated.

Test 1: Console Output for SemPress with child mods, Friends, and no Post Kinds

Sep 07 21:17:34[Thu Sep 07 21:17:34.274279 2023] [core:notice] [pid 1] AH00051: child pid 1197 exit signal Segmentation fault (11), possible coredump in /etc/apache2
Sep 07 21:17:35PHP Warning: Trying to access array offset on value of type null in /app/data/public/wp-content/themes/sempress/functions.php on line 123
Sep 07 21:17:35Warning: Trying to access array offset on value of type null in /app/data/public/wp-content/themes/sempress/functions.php on line 123

(I don't think the functions.php warning is relevant, on another test it showed up well after the seg fault, but including it just in case)

Base SemPress with no mods, Friends, and no Post Kinds

Sep 07 21:32:49[Thu Sep 07 21:32:49.216435 2023] [core:notice] [pid 1] AH00051: child pid 1240 exit signal Segmentation fault (11), possible coredump in /etc/apache2

Finally, here is the console output with Query Monitor enabled (when Query Monitor is up, I get a critical error screen on Admin > Posts instead of the 504 screen from Cloudron)

Sep 07 22:00:46[Thu Sep 07 22:00:46.509803 2023] [php:error] [pid 1311] [client REDACTED] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 135168 bytes) in /app/data/public/wp-content/plugins/query-monitor/classes/Backtrace.php on line 135, referer: https://DOMAIN/wp-admin/themes.php
Sep 07 22:00:46[Thu Sep 07 22:00:46.511760 2023] [php:error] [pid 1311] [client REDACTED] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 98304 bytes) in /app/data/public/wp-content/object-cache.php on line 2470, referer: https://DOMAIN.php

Note that these issues occurred with SemPress, my child theme for SemPress, Autonomie, and the default Twenty Twenty-Three theme.

Conditions where segfault does not occur:

  • Post Kinds enabled, Friends status irrelevant
  • Post Kinds and Friends disabled

Additional Notes

  • On my SemPress install, theme icon thought bubble does not appear next to status posts. Icons appear to work for all other natively-supported post types. Icon does not appear when Friends is inactive but no error occurs. Icon does work with Automonie but I replicated the Friends/Post Kinds segfault issue -- so icon problem on my SemPress install does not seem relevant.
  • I tried de-activating all possibly offending plugins, including caching, Autoptimize, The SEO Framework, plugins which add post types (Growelle Guestbook, VS Events), and most of the IndieWeb suite sans ActivityPub itself. But the only ones that seem to make a difference are Friends and Post Kinds. Please advise if there are any other specific ones I should look for.

Conclusion

Thank you much for all your work on the plugin and I look forward to using it going forward. If you need or want additional information, please advise and I will respond ASAP.

@dshanske
Copy link

dshanske commented Sep 8, 2023

Anything I can do to help...please advise. I wrote Post Kinds.

@nafnlj
Copy link
Author

nafnlj commented Sep 8, 2023

@dshanske Thank you for the plugin, I'm using it for the first time now that I have a project that works well with it. I clarified my issue based on some advice with a new section at the top. From my testing -- everything works when Post Kinds is enabled. It seems like my issue is only when Friends is enabled and Post Kinds is not enabled. If there is anything you want to confirm about my set up, please advise and I will get back to you.

@akirk
Copy link
Owner

akirk commented Sep 8, 2023

@nafnlj Sorry about that and thank you for your report so that we can try and fix it!

A segfault is hard to debug since there is no error message. What version of PHP and which version of WordPress are you using?

Since you mention there being an "ActivityPub post", does it mean the ActivityPub plugin is installed as well? Are there any other plugins?

Also, what I am not fully grasping how a deactivated Post Kinds plugin plays a role here. Are you saying that if you uninstalled the Post Kinds plugin but activated the Friends plugin, the segfault does not occur?

@akirk
Copy link
Owner

akirk commented Sep 8, 2023

I've tried to reproduce it with https://playground.wordpress.net/?theme=sempress&plugin=friends&plugin=indieweb-post-kinds (you need to deactivate the Post Kinds plugin since it is automatically activated) but it never crashes. Would you be willing to provide me with an export ZIP of your WordPress installation (since it sounds like a bit of a test installation, I thought this might be ok), so that we could try and run this in the WordPress Playground to see if we can reproduce it there?

@nafnlj
Copy link
Author

nafnlj commented Sep 8, 2023

@akirk Thank you for taking the time to respond and look into the issue. I appreciate all the work you, @dshanske, and others are putting into these tools and hope that my issue turns out to be helpful if it's not entirely unique to my set-up.

Version Info

I forgot to include WP version and PHP info, my apologies. See below:
WordPress version: 6.3.1
PHP version: 8.1

ActivityPub Explanation

I apologize for not being clear on ActivityPub. See clarified explanation below:

  • I have ActivityPub, Friends, and Post Kinds installed
  • I boosted one post from my Mastodon account and it appeared as a post on my site thanks to Friends
  • If that post is in the published post list in Admin > Posts, I get a segfault if I try to access Admin > Posts with Friends installed and Post Kinds uninstalled
  • I do NOT get a segfault if either Post Kinds and Friends are installed or Friends is uninstalled
  • The same is true of any post that I assign post format = Status (as in the regular post formats that come with SemPress, not Post Kinds's Kinds). While Post Kinds is active, the regular Post Formats selection in SemPress is still accessible so I can also assign a regular post format.
  • It does not seem to be the case with the non-Status post formats (I tested them to gain a better understanding of the issue)

I tried different scenarios involving disabling/enabling ActivityPub but it does not seem to have any influence on the issue.

Clarifying Post Kinds role

"Also, what I am not fully grasping how a deactivated Post Kinds plugin plays a role here. Are you saying that if you uninstalled the Post Kinds plugin but activated the Friends plugin, the segfault does not occur?"

No, see scenarions below:

  • Friends + Post Kinds = No segfault
  • Friends + No Post Kinds = Segfault
  • No Friends + No Post Kinds = No segfault

I tested Friends with all of the possible Post Formats configuration combinations in Settings but the issue remained consistent across the tests.

Plugin List

Below is my full plugin list with notes on a few -- at the moment I am still deciding what I want to use for the final site and what I can replace, hence some of the size:

ActivityPub, ActivityStream extension, Async JavaScript, Autoptimize, Classic Editor, Classic Widgets, Friends, Gwolle Guestbook, IndieAuth, IndieWeb, Nodeinfo, plugin load filter, Post Kinds, Redirect Gravatar requests, Redirection, Redis Object Cache, Rewrite Rules Inspector, Simple Local Avatars, Syndication Links, The SEO Framework, TWTXT, Unbloater, VS Event List, VS Link Manager, WebFinger, Webmention, WebSub (FKA. PubSubHubbub), WP REST Cache, WP Super Cache, CUSTOM (https://giteacoffee.emucafe.org/naferrell/enable-pingbacks-for-wordpress-pages/src/branch/main/enable-pinpgacks-for-pages.php)

Notes:

  • I omitted some security plugins and plugins that would obviously have no effect on post data (e.g., press this, JSON feed, and a few others -- but I list all of my performance plugins in case one of those could cause an issue I'm missing)
  • I tested disabling all of the caching/plugin plugins, Redis, WP Super, Autoptimize, REST, but none of them have made any difference. I initially had the issue before trying WP REST Cache.
  • I also tried disabling Unbloater since I use that to disable some parts of WordPress, but it made no difference
  • I checked Flush Rewrite Rules every time I installed something which may have an effect

Testing Options

  • Although I am still working through issues before inviting more people to post, my site is public and live: https://social.emucafe.org/
  • I don't mind exporting - I only have a few posts at the moment
  • As you may imagine from the fact I am doing this all in a live environment, I do not know much about the best way to export for testing in WP Playground. If you have any recommendations in the form of a plugin or a resource I can read for doing it from the server side, that would be appreciated.
  • At the moment I have a full exports with all of my plugins, themes, and the .xml with all of my posts, users, and taxonomies if that would be sufficient.

Conclusion

Thank you again for all your work and for looking into the issue. I look forward to being able to use all of these tools on my final set-up. Please let me know if you need any additional info.

EDITS: Added extra note on ActivityPub, reduced plugin list to cover only those from IndieWeb suite or related to caching/WP features, excluded feed plugins and most security plugins, and clarified last section

@nafnlj
Copy link
Author

nafnlj commented Sep 9, 2023

Additional tests

I performed a few additional tests that may be helpful.

  1. My segfault is triggered when I have a post with either WP Format Status or a Friends re-post/boost from Mastodon and I try to enter posts without Post Kinds enabled. However, I can access Friends > Automatic Status and see the status posts there.
  2. If I change the WP Format of a status post -- e.g., from status to anything, it does not display correctly -- as in my whole theme is distorted when the post is on screen. However, I can safely change other formats -- for example Aside to Standard.
  3. I tried removing themes, deactivating plugins, and reinstalling one by one, but I ran into the same issues.

@nafnlj
Copy link
Author

nafnlj commented Sep 12, 2023

Additional Info

Update based on #208

I read issue #208 and noted that the problem seemed similar to my issue. The poster there made a specific reference to posts without titles. I confirmed that the lack of titles for Status posts on my site is connected to the issue on my site -- specifically the issue does not occur if WP-status format posts or posts reblogged from Mastodon have titles. See detailed outline below:

  • Problem: If Friends is active and I have a status post without a title in Admin > Posts, trying to enter posts causes a segmentation fault.
  • Note on Problem: If Post Kinds is active, Friends + Status post segmentation fault does not occur. Note that while I use ActivityPub, the status of ActivityPub has no effect on the issue occurring.
  • Steps to Reproduce: (1) Friends is active; (2) Post Kinds is inactive; (3) Status post with title exists in Posts; (4) Try to enter Admin > Posts
    • Additional Note: If the Status post would not be immediately visible in Admin Posts, for example let us say the only status post is in trash, segfault would not occur even with steps to reproduce unless I tried to go where the status post is -- in this example that would be the trash menu.
  • Fix: If the status post has a title, no issue occurs. I had a single status post that I reblogged from Mastodon using Friends + ActivityPub. I edited it from the WordPress editor to give it a title, here being "Test." I then temporarily deactivated Post Kinds, left Friends active, and entered Admin > Posts. No issue occurred.
  • Impact: On my set up at least, in order to avoid conflict in Admin > Posts with Friends and Status format posts with Friends active, one of two things must be true. I must either have Post Kinds active or the status posts, whether they are WP-format Status or reblogged from Mastodon, must have titles.
  • Other Notes: My prior posts remain valid with respect to the issue as I understand it on my site. The only change is my finding that assigning status posts titles causes the issue to not occur even when Post Kinds is temporarily disabled.
  • Possible differences between my case and Friends Plugin causes wp-die on All Posts page in dashboard when a post has no title? #208: I think that I have the same issue as 208, but I will note a few potential differences. In my case, when I try to access Admin > Posts after all of the conditions for triggering the issue, I get a Cloudron loading screen instead of the critical error message. I can see a critical error message if I have Query Monitor active, but it is not exactly the same as what is described in 208. Logs for me specifically show segmentation fault as I noted in the first post. Another difference (possible) is that in my case, having a regular Status format with no title leads to the same outcome as the reblogged Mastodon post.

@jeckman
Copy link

jeckman commented Sep 12, 2023

Thanks - I was just coming to see if I thought it was related to #208 which i opened.

I don't have Cloudron and don't get a segfault, but do get a silent WP_DIE with no clear log of output.

For me it happens any time I have reblogged or boosted statuses- I am not using "Post Kinds"

Similarly, I only have the problem when the posts in question are active in the admin posts list - if I set them to draft or there are other newer posts so they are not showing on the first page, no error occurs - it's only when the posts list table is being drawn.

I've been tying to find the time to go in an instrument the WP code happening at the point of drawing that table to isolate but haven't found the time. It "feels" like there is something about those kinds of posts (reblogs/boosts of statuses that came in via Friends and ActivityPub) that fails - something WordPress core expects to be set but isn't based on how thoses posts got created

@akirk
Copy link
Owner

akirk commented Sep 18, 2023

At the moment I have a full exports with all of my plugins, themes, and the .xml with all of my posts, users, and taxonomies if that would be sufficient.

@nafnlj Could you send it to me to wpfriends249@kirk.at? Thanks!

@nafnlj
Copy link
Author

nafnlj commented Sep 20, 2023

@akirk I have sent the email with plugins, themes, and posts as of 9/9/23

My site is now working as expected. I can have Friends active with Post Kinds enabled and one status post and access my post menu without the error. I have not made any changes to the site that would obviously implicate the issue -- the most significant changes I made were disabling compression in WP Super Cache and a few style changes to the child theme. You can see if the email I sent gives any clues. My best guess is that maybe adding a few additional post types somehow resolved the error -- e.g., I did make my first photo format post since I last observed the issue.

Please let me know if there is any additional information that I could provide to help diagnose the issue generally even though it seems to be resolved in my case for the time being.

@akirk
Copy link
Owner

akirk commented Oct 13, 2023

I think I have finally been able to reproduce this and released a fix in 2.8.2 (#260). Thanks everyone for your patience and I hope this was really it. Please report if you still encounter the problems.

@dshanske
Copy link

I think I have finally been able to reproduce this and released a fix in 2.8.2 (#260). Thanks everyone for your patience and I hope this was really it. Please report if you still encounter the problems.

Post Kinds does the same display change for empty titles, but it doesn't use the excerpt

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

4 participants