Skip to content

Launchpad: Adjust Logstash ref to fix fatal on WoA sites#31284

Merged
samiff merged 8 commits into
trunkfrom
fix/woa-fatal-launchpad
Jun 8, 2023
Merged

Launchpad: Adjust Logstash ref to fix fatal on WoA sites#31284
samiff merged 8 commits into
trunkfrom
fix/woa-fatal-launchpad

Conversation

@sixhours
Copy link
Copy Markdown
Contributor

@sixhours sixhours commented Jun 8, 2023

Fixes #31283

Proposed changes:

  • Wrap references to Logstash in an IS_WPCOM check to prevent fatal errors on WoA sites, and return WP_Error if task initialization fails for any site.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Create a WoA developer site if you don't have one already
  • Use the Jetpack Beta Tester plugin to apply this patch to your WoA site
  • Alternatively, apply this patch to the site via SSH/rsync or SFTP; you may need to check out this patch locally and overwrite the entire contents of the /launchpad directory, not just this patched file. You'll find the files in /wpcomsh/vendor/automattic/jetpack-mu-wpcom/src/features/launchpad/
  • tail -F /tmp/php-errors on the WoA site
  • Ensure you no longer see fatal errors like the following:
Screen Shot 2023-06-08 at 4 01 21 PM

@sixhours sixhours requested review from a team and samiff June 8, 2023 19:47
@sixhours sixhours self-assigned this Jun 8, 2023
@sixhours sixhours changed the title Remove logstash ref to fix fatal on WoA sites Launchpad: Remove logstash ref to fix fatal on WoA sites Jun 8, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 8, 2023

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run

bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/woa-fatal-launchpad

to get started. More details: p9dueE-5Nn-p2

@github-actions github-actions Bot added the [Package] Jetpack mu wpcom WordPress.com Features label Jun 8, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 8, 2023

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Mu Wpcom plugin:

  • Next scheduled release: July 4, 2023.
  • Scheduled code freeze: June 26, 2023.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 8, 2023
* @param array $task_definitions The tasks to initialize.
*/
function wpcom_launchpad_init_listeners( $task_definitions ) {
require_once WP_CONTENT_DIR . '/lib/log2logstash/log2logstash.php';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you still wanted to do this on simple wpcom for now, could you use a file_exists check before the require and function_exists check in the catch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the IS_WPCOM global defined on Atomic sites? That might be a simpler check... looks like that's what we do in launchpad.php, though that's also filtering by blog ID.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) would work for checking simple wpcom sites. That constant shouldn't be on Atomic sites, it's how the status package checks for example:

/**
* Determine if this is a Simple platform site.
*
* @return bool
*/
public function is_wpcom_simple() {
return Constants::is_defined( 'IS_WPCOM' ) && true === Constants::get_constant( 'IS_WPCOM' );
}

@samiff
Copy link
Copy Markdown
Contributor

samiff commented Jun 8, 2023

Verified this will correct the issue. If we want to merge as-is, will need to add a changelog and fix the lint error about empty catch block.

@sixhours sixhours changed the title Launchpad: Remove logstash ref to fix fatal on WoA sites Launchpad: Adjust Logstash ref to fix fatal on WoA sites Jun 8, 2023
@sixhours sixhours added the [Status] Needs Team Review Obsolete. Use Needs Review instead. label Jun 8, 2023
@samiff samiff self-requested a review June 8, 2023 20:47
@sixhours
Copy link
Copy Markdown
Contributor Author

sixhours commented Jun 8, 2023

I'm headed out for the weekend, @nelsonec87 or @andres-blanco please feel free to commandeer this PR and get it shipped to avoid blocking deployment to WoA. Thank you!!

@samiff samiff removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 8, 2023
@github-actions github-actions Bot added the [Plugin] mu wpcom jetpack-mu-wpcom plugin label Jun 8, 2023
Copy link
Copy Markdown
Contributor

@samiff samiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the quick fix @sixhours 🙇

@samiff samiff added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Jun 8, 2023
@samiff samiff enabled auto-merge (squash) June 8, 2023 21:13
@samiff samiff merged commit 7253b9f into trunk Jun 8, 2023
@samiff samiff deleted the fix/woa-fatal-launchpad branch June 8, 2023 21:13
@github-actions github-actions Bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jun 8, 2023
taipeicoder added a commit that referenced this pull request Apr 29, 2026
Drop verbose framing and references outside wpcomsh / jetpack
(log2logstash, RFC 4648, libsodium-seal aside, fix #31284,
memcached/Atomic detail, Error_Handler precedent). No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Jetpack mu wpcom WordPress.com Features [Plugin] mu wpcom jetpack-mu-wpcom plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jetpack-mu-wpcom: fatal on WoA sites from Launchpad code

2 participants