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.52k stars 9.31k forks source link

Cron jobs from disabled Magento_Analytics module is getting scheduled and returns an error #33440

Closed AartiJogiya closed 3 years ago

AartiJogiya commented 3 years ago

Description (*)

Magento_Analytics module has two cron jobs as mentioned below-

Configurations defined in crontab.xml are as below:

Cron expressions are stored in core_config_data table as mentioned below:

Job name path value
analytics_subscribe crontab/default/jobs/analytics_collect_data/schedule/cron_expr 0
analytics_collect_data crontab/default/jobs/analytics_collect_data/schedule/cron_expr 00 02 *

When Magento_Analytics module is disabled, It will not get instance and method from crontab.xml but having cron expression stored in core_config_data table so Magento_Cron module is scheduling cron jobs which returns “No callbacks found for cron job” error when job runs Here if a module is disabled then it should not schedule any jobs of that module.

Preconditions (*)

  1. Magneto 2.4.2, 2.4-develop
  2. In core_config_data table, make sure values are present for below paths:
    • crontab/default/jobs/analytics_subscribe/schedule/cron_expr
    • crontab/default/jobs/analytics_collect_data/schedule/cron_expr
  3. Disabled Magento_Analytics module

Steps to reproduce (*)

  1. Setup and run Magento cron

Expected result (*)

Actual result (*)

Workaround

Magento_Cron module is generating cron schedules by preparing an array object having job-name, instance, method and scheduleby following below process:

These two arrays are getting merged using array_replace_recursive function which creates an array object and generates schedules to cron_schedules table.

Here, Magento_Analytics module is disabled so it will not get the first array having instance and method from crontab.xml. So it will only get second array having a job name and schedule from database and it generates cron schedule even if it doesn't have instance and method and therefore returns error "No callbacks found for cron job" from file: magento/module-cron/Observer/ProcessCronQueueObserver.php (function name- _runJob).

If module is disabled and not getting instance and method for cron job then it should not generate cron array object which will prevent scheduling job.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 3 years ago

Hi @AartiJogiya. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 3 years ago

Hi @engcom-Lima. 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-Lima commented 3 years ago

Hi @AartiJogiya

We tried to reproduce the issue on 2.4-develop but were not able to do it.

Here is what we did:

  1. We disabled Magento Analytics from Admin Panel: Stores > Configuration page under the General > Advanced Reporting tab.
  2. We ran cron as suggested.
  3. Checked cron_schedule table for any errors but couldn’t find any scheduled crons for cron jobs analytics_subscribe or analytics_collect_data.

So, in order to reproduce this on 2.4-develop, can you please check the above steps and let us know if you did things any differently or perhaps you can provide extra details for us to reproduce ?

engcom-Lima commented 3 years ago

Closing this issue as there has been no update from the reporter on the same.

hostep commented 3 years ago

@engcom-Lima: I think the issue does exist, I've seen it happening with other modules as well.

Therefore, could you please try the following instead of what you tried before:

kanevbg commented 2 years ago

This exists definitely in 2.3 it seem in 2.4 too

hostep commented 2 years ago

@engcom-Lima: could you please try this again with the steps mentioned above? Thanks! :)