magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.53k stars 9.31k forks source link

Error when run command setup:upgrade with custom DB trigger #38481

Open manhtranisobar opened 7 months ago

manhtranisobar commented 7 months ago

Preconditions and environment

Steps to reproduce

Expected result

The command bin/magento setup:upgrade is ran successfully

Actual result

An error appeared: Warning: Trying to access array offset on value of type null in vendor/magento/framework/Mview/View/Subscription.php on line 357

Additional information

It seems there are 2 conditions to error appear: A custom trigger with name format which is different from other Mview triggers. This custom trigger is created for tables, that are used by Mview config.

Release note

No response

Triage and priority

m2-assistant[bot] commented 7 months ago

Hi @manhtranisobar. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

adarshkhatri commented 7 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 7 months ago

Hi @adarshkhatri. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 7 months ago

Hi @adarshkhatri, here is your Magento Instance: https://f8b27cd8fbd9bfb3201fb190d9b6db02.instances-prod.magento-community.engineering Admin access: https://f8b27cd8fbd9bfb3201fb190d9b6db02.instances-prod.magento-community.engineering/admin_d907 Login: 232bf8cd Password: 8c0dbb9bccb1

manhtranisobar commented 7 months ago

Hi @adarshkhatri , I have detailed issue reproduce steps, thank to check again.

m2-assistant[bot] commented 7 months ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 7 months ago

Hello @manhtranisobar,

Thank you for the report and collaboration!

Tried to reproduce this issue on 2.4-develop, but in our case it is not reproducible. Created a AFTER INSERT custom trigger to store table with name trg_test_mview, please take a look at the screenshot below:

image

With the custom trigger added, while running bin/magento setup:upgrade we did not see any error.

Please let us know if we are missing anything.

Thank you.

manhtranisobar commented 7 months ago

Hi @engcom-November

It is strange, If you can use to debug logic of function \Magento\Framework\Mview\TriggerCleaner::removeTriggers then you can see It will try to create a dummy view with old_view id then It will be loaded by vendor/magento/framework/Mview/View/Subscription.php:357 so error appeared.

It see there are 2 conditions to error appear:

engcom-November commented 7 months ago

Hello @manhtranisobar,

Thank you for the quick response!

As you mentioned, This custom trigger is created for tables, that are used by Mview config. Created a custom trigger for a table that already has triggers from mview configuration, with this we were able to reproduce this issue.

Please take a look at the screenshot below: Added a custom trigger to catalog_product_entity table, which already has 3 triggers.

image

While running setup:upgrade we got the error

image

Hence confirming the issue.

Thank you.

github-jira-sync-bot commented 7 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-11487 is successfully created for this GitHub issue.

m2-assistant[bot] commented 7 months ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

github-jira-sync-bot commented 7 months ago

:x: You don't have permission to export this issue.

erwinschaap commented 2 months ago

Any updates on this issue?