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

Prevent possible fatal error when user holds edit lock for a deleted order #39497

Merged
merged 2 commits into from Aug 1, 2023

Conversation

jorgeatorres
Copy link
Member

@jorgeatorres jorgeatorres commented Jul 31, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

With HPOS enabled, if an order gets deleted while being edited in a different browser window/session, a fatal error is logged when the AJAX heartbeat attempts to refresh the edit lock. This doesn't have any serious implication, other than an error being logged, but better to not produce it at all ("silence is golden").

Closes #39354.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. On the admin, create an order and open it for editing. Do not close this browser tab.
  2. Open a new browser tab and go to WC > Orders.
  3. Check off the checkbox next to the order from step 1.
  4. Choose "Move to trash" in the bulk actions dropdown and click "Apply".
  5. Go to the Trash and empty it (or permanently delete the order).
  6. Go back to the browser tab from step 1.
  7. Wait a few minutes (with the tab open) for a "heartbeat" request to come through.
    You can use the dev tools to monitor for such XHR request.
  8. Confirm that:
    • On trunk, a PHP critical error is logged:
      CRITICAL Uncaught Error: Call to a member function get_type() on bool in /.../woocommerce/src/Internal/Admin/Orders/EditLock.php:103
      
    • On this branch, no error is triggered.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@jorgeatorres jorgeatorres added the focus: custom order tables / HPOS Issues related to High-Performance Order Storage (HPOS) née Custom Order Tables. label Jul 31, 2023
@github-actions github-actions bot added focus: react admin [team:Ghidorah] plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Jul 31, 2023
@github-actions
Copy link
Contributor

Test Results Summary

Commit SHA: 64e716e

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202611m 17s
E2E Tests1890019020817m 25s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@jorgeatorres jorgeatorres marked this pull request as ready for review July 31, 2023 19:27
@jorgeatorres jorgeatorres requested review from a team and coreymckrill and removed request for a team July 31, 2023 19:28
@github-actions
Copy link
Contributor

Hi @coreymckrill,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

1 similar comment
@github-actions
Copy link
Contributor

Hi @coreymckrill,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Collaborator

@coreymckrill coreymckrill left a comment

Choose a reason for hiding this comment

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

👍 I setup logging to use WC_Log_Handler_DB and confirmed that with this branch, the fatal error no longer occurs when the heartbeat can't find the order it's tracking.

@coreymckrill coreymckrill added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Aug 1, 2023
@lanej0 lanej0 removed the needs: analysis Indicates if the PR requires a PR testing scrub session. label Aug 1, 2023
@lanej0 lanej0 merged commit 14d9760 into trunk Aug 1, 2023
31 checks passed
@lanej0 lanej0 deleted the fix/39354 branch August 1, 2023 21:37
@github-actions github-actions bot added this to the 8.1.0 milestone Aug 1, 2023
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Aug 1, 2023
@lanej0 lanej0 removed the needs: analysis Indicates if the PR requires a PR testing scrub session. label Aug 1, 2023
tommyshellberg pushed a commit that referenced this pull request Aug 7, 2023
…order (#39497)

* Prevent possible fatal error when locked order is deleted

* Add changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: custom order tables / HPOS Issues related to High-Performance Order Storage (HPOS) née Custom Order Tables. plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible error in edit lock refresh code when order does no longer exist
3 participants