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.55k stars 9.32k forks source link

Import History Execution Time wrong for other than en_US user locale #38373

Open mihaimatei opened 9 months ago

mihaimatei commented 9 months ago

Preconditions and environment

Steps to reproduce

  1. Access admin of vanilla instance, any version (tested from 2.3.7 to 2.4.7-beta2)
  2. Change admin user locale to "German (Switzerland)" [de_CH] or "Romanian" [ro_RO] - this can be also done at any point before the Import runs (if vanilla instance with no language packs installed to affect the export)
  3. Create a test product
  4. System > Export > Products: CSV, Enclose fields > Export > Run Cron > Download CSV
  5. System > Import > Products / Behaviour: Add/Update > Check Data > Import
  6. System > Import History > Check "Execution Time" column which shows wrong time interval
execution-time-wrong-when-non-en_US-locale

Expected result

Import History shows correct execution time of the import when import is run by a user with non-en_US locale (de_CH and ro_RO tested)

Actual result

Import History shows incorrect execution time of the import when import is run by a user with non-en_US locale (de_CH and ro_RO tested)

Additional information

Problem appears in the \Magento\Framework\Stdlib\DateTime\Timezone::date method, in the switch branch of case (!is_numeric($date)).

Below is a summarised stack trace with relevant dumps which I've performed to track the issue:

IMPORT CSV - en_US locale admin user - CORRECT Execution Time

\Magento\ImportExport\Model\History::setExecutionTime($executionTime = 'Validation') \Magento\ImportExport\Model\History::setExecutionTime($executionTime = 'In Progress') \Magento\Framework\Stdlib\DateTime\Timezone::date($date = '2024-01-22 15:42:12')

IMPORT CSV - de_CH locale admin user - WRONG Execution Time

\Magento\ImportExport\Model\History::setExecutionTime($executionTime = 'Validation') \Magento\ImportExport\Model\History::setExecutionTime($executionTime = 'In Progress') \Magento\Framework\Stdlib\DateTime\Timezone::date($date = '2024-01-22 15:59:51')

The execution time might not seem important for user triggered csv imports, but when a custom import is built over the import-export module and imports run as scheduled tasks, import history execution time might be of importance to assess the health of the import, hence the severity can be evaluated even as S2.

In case of a custom import built on top of the import-export module, workaround for getting the correct execution time would be to set locale to en_US before triggering the import methods, but this might affect other data handling in the actually imported data.

Release note

No response

Triage and priority

m2-assistant[bot] commented 9 months ago

Hi @mihaimatei. 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:

m2-assistant[bot] commented 9 months ago

Hi @engcom-Dash. 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-Dash commented 9 months ago

Hi @mihaimatei

Thanks for reporting and collaboration.

Verified the issue on both magento 2.4 dev instance and 2.4.7-beta2 instance but the issue is not reproducable.

Seeing correct import history execution time for non-en_US locale.

Please refer the screenshots attached.

38373_1 38373_2
mihaimatei commented 9 months ago

@magento give me 2.4-develop instance

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

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

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

Hi @mihaimatei, here is your Magento Instance: https://882a5b5e078303041ba6887b682795a9.instances-prod.magento-community.engineering Admin access: https://882a5b5e078303041ba6887b682795a9.instances-prod.magento-community.engineering/admin_87bb Login: 370f93a6 Password: fd04296bb01c

mihaimatei commented 9 months ago

Hi @engcom-Dash , thank you for checking! In your test, I see you changed the General settings locale, and this is why you probably cannot replicate. EDIT: Actually, I see a pretty big difference in your reported times too (~10 times more execution time reported for same file).

In the Steps to reproduce, I've mentioned "Change admin user locale", without touching General settings locale, so they should be left to default (Locale: English US, Timezone: Los Angeles).

Here is the result following my Steps to reproduce, on the provided Magento instance offered by the deployment service:

Screenshot 2024-01-24 at 14 23 22

You can also access this instance and:

engcom-Dash commented 9 months ago

@magento give me 2.4-develop instance

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

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

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

Hi @engcom-Dash, here is your Magento Instance: https://882a5b5e078303041ba6887b682795a9.instances-prod.magento-community.engineering Admin access: https://882a5b5e078303041ba6887b682795a9.instances-prod.magento-community.engineering/admin_8c93 Login: 29ff8dd3 Password: 9e11d8f54c7c

engcom-Dash commented 9 months ago

Hi @mihaimatei

Thanks for reporting and collaboration.

Verified the issue in magento 2.4 dev instance and the issue is reproducable.

The import history execution time is wrong for other than en_US user locale.

Please refer the attached screenshot.

Screenshot 2024-01-25 at 12 39 57 PM
github-jira-sync-bot commented 9 months ago

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

m2-assistant[bot] commented 9 months ago

:white_check_mark: Confirmed by @engcom-Dash. Thank you for verifying the issue.
Issue Available: @engcom-Dash, 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 9 months ago

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

github-jira-sync-bot commented 9 months ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-10929