Skip to content

Unable to run in a single-threaded PHP server #1958

@akirk

Description

@akirk

Quick summary

The ActivityPub plugin depends on the webserver being multi-worker or multi-threaded.

Steps to reproduce

  1. Use php -S localhost:8080 in the root of a WordPress install that has the ActivityPub plugin.
  2. Navigate to wp-admin/options-general.php?page=activitypub
  3. Hangs until the CLI server errors out with Fatal error: Maximum execution time of 30+2 seconds exceeded (terminated) in wp-includes/Requests/src/Transport/Curl.php on line 204

Site owner impact

Fewer than 20% of the total website/platform users

Severity

Minor

What other impact(s) does this issue have?

No response

If a workaround is available, please outline it here.

It works if you set the timeout to a low value like this:

add_filter( 'activitypub_remote_get_timeout', function() { return 1; } );

The reason for this is that the author page availability is checked (is_author_url_accessible) with a blocking HTTP request in the same request and the built-in php webserver is single-threaded. See this backtrace:

(
    [0] => Array
        (
            [file] => wp-includes/Requests/src/Requests.php
            [line] => 469
            [function] => request
            [class] => WpOrg\Requests\Transport\Curl
            [type] => ->
        )

    [1] => Array
        (
            [file] => wp-includes/class-wp-http.php
            [line] => 420
            [function] => request
            [class] => WpOrg\Requests\Requests
            [type] => ::
        )

    [2] => Array
        (
            [file] => wp-includes/class-wp-http.php
            [line] => 658
            [function] => request
            [class] => WP_Http
            [type] => ->
        )

    [3] => Array
        (
            [file] => wp-includes/http.php
            [line] => 68
            [function] => get
            [class] => WP_Http
            [type] => ->
        )

    [4] => Array
        (
            [file] => wp-content/plugins/activitypub/includes/class-http.php
            [line] => 157
            [function] => wp_safe_remote_get
        )

    [5] => Array
        (
            [file] => wp-content/plugins/activitypub/includes/class-http.php
            [line] => 290
            [function] => get
            [class] => Activitypub\Http
            [type] => ::
        )

    [6] => Array
        (
            [file] => wp-content/plugins/activitypub/includes/wp-admin/class-health-check.php
            [line] => 195
            [function] => get_remote_object
            [class] => Activitypub\Http
            [type] => ::
        )

    [7] => Array
        (
            [file] => wp-content/plugins/activitypub/includes/wp-admin/class-health-check.php
            [line] => 131
            [function] => is_author_url_accessible
            [class] => Activitypub\WP_Admin\Health_Check
            [type] => ::
        )

    [8] => Array
        (
            [function] => test_author_url
            [class] => Activitypub\WP_Admin\Health_Check
            [type] => ::
        )

    [9] => Array
        (
            [file] => wp-content/plugins/activitypub/includes/wp-admin/class-health-check.php
            [line] => 49
            [function] => call_user_func
        )

    [10] => Array
        (
            [file] => wp-content/plugins/activitypub/includes/wp-admin/class-welcome-fields.php
            [line] => 72
            [function] => count_results
            [class] => Activitypub\WP_Admin\Health_Check
            [type] => ::
        )

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions