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

klarna_logs: Unique constraint violation found #34634

Closed fritzmg closed 2 years ago

fritzmg commented 3 years ago

The klarna_logs table has a primary key definition of smallint (not even unsigned), meaning that it can only hold up to 32767 entries. Once the klarna_logs table is full, the checkout will not work anymore, if the Klarna payment module is enabled in the store configuration, due to the following error:

[2021-11-15 09:54:47] main.CRITICAL: Unique constraint violation found {"exception":"[object] (Magento\\Framework\\Exception\\CouldNotSaveException(code: 0): Unique constraint violation found at vendor/klarna/module-core/Model/LogRepository.php:77)"}

Preconditions (*)

Steps to reproduce (*)

After the preconditions are met:

  1. Add a product to the cart.
  2. Go to checkout.

Expected result (*)

The checkout it supposed to work fine.

Actual result (*)

The checkout will not load (API will respond with 500) and the aforementioned error will be in the logs.


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

As a workaround you can either disable the Klarna payment for your checkout, or truncate the klarna_logs table manually, or execute

ALTER TABLE `klarna_logs` CHANGE `log_id` `log_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Log Id';

to change log_id from smallint(6) to int(10) unsigned so that the maximum will be 4294967295 instead of just 32767.

To fix this, the primary key definition of the klarna_logs table should be changed at the very least within the extension.

m2-assistant[bot] commented 3 years ago

Hi @fritzmg. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

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:

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

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


: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, 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

bjornmeat commented 3 years ago

Hi @fritzmg, this is addressed by Klarna directly: https://docs.klarna.com/platform-solutions/magento/general/notice-for-users-of-magento-v243/

engcom-Delta commented 3 years ago

Hi @fritzmg, Can we close it as it is taking care by Klarna directly?

Thanks

m2-assistant[bot] commented 3 years ago

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

fritzmg commented 3 years ago

@engcom-Delta any new Magento installation will still be affected by this. Klarna still has to release a new version of its Magento extension and then Magento needs to do a new release, since Magento requires a fixed version constraint, instead of an open one (which should be changed imho).

m2-assistant[bot] commented 3 years 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:

ihor-sviziev commented 2 years ago

@magento/ext-klarna could someone check this issue?

engcom-November commented 2 years ago

Hi @fritzmg , This is a Klarna issue and code of this extension is not part of https://github.com/magento/magento2 git repository. We are closing this issue as community is not able to provide fix for it in this repository. All questions, issue reports and fix for them should be addressed to the corresponding extension owners(support) on the Magento Market place page Thank you.

fritzmg commented 2 years ago

@engcom-November it is an extension that Magento itself requires:

application@e6e1e016ad53:/app$ composer why klarna/m2-payments
magento/product-community-edition  2.4.3-p1  requires  klarna/m2-payments (8.3.6)
{
    "name": "magento/product-community-edition",
    "version": "2.4.3-p1",
    "dist": {
        "type": "zip",
        "url": "https://repo.magento.com/archives/magento/product-community-edition/magento-product-community-edition-2.4.3.0-patch1.zip",
        "shasum": "9237fc185dc68770e4fa7a9b647cd7cde9bb9103"
    },
    "require": {
        "amzn/amazon-pay-and-login-magento-2-module": "4.2.2",
        "colinmollenhour/cache-backend-file": "~1.4.1",
        "colinmollenhour/cache-backend-redis": "1.11.0",
        "colinmollenhour/credis": "1.11.1",
        "colinmollenhour/php-redis-session-abstract": "~1.4.0",
        "composer/composer": "^1.9 || ^2.0",
        "dotmailer/dotmailer-magento2-extension-package": "4.12.0",
        "elasticsearch/elasticsearch": "~7.11.0",
        "ext-bcmath": "*",
        "ext-ctype": "*",
        "ext-curl": "*",
        "ext-dom": "*",
        "ext-gd": "*",
        "ext-hash": "*",
        "ext-iconv": "*",
        "ext-intl": "*",
        "ext-mbstring": "*",
        "ext-openssl": "*",
        "ext-pdo_mysql": "*",
        "ext-simplexml": "*",
        "ext-soap": "*",
        "ext-xsl": "*",
        "ext-zip": "*",
        "guzzlehttp/guzzle": "^6.3.3",
        "klarna/m2-payments": "8.3.6",
        "laminas/laminas-captcha": "^2.10",
        "laminas/laminas-code": "^3.5.1",
        "laminas/laminas-crypt": "^3.4.0",
        "laminas/laminas-db": "^2.12.0",
        "laminas/laminas-dependency-plugin": "^2.1.0",
        "laminas/laminas-di": "^3.2.0",
        "laminas/laminas-escaper": "2.7.0",
        "laminas/laminas-eventmanager": "^3.0.0",
        "laminas/laminas-feed": "^2.13.0",
        "laminas/laminas-filter": "^2.11",
        "laminas/laminas-http": "^2.6.0",
        "laminas/laminas-i18n": "^2.7.3",
        "laminas/laminas-json": "^3.2.0",
        "laminas/laminas-mail": "^2.9.0",
        "laminas/laminas-mime": "^2.8.0",
        "laminas/laminas-modulemanager": "^2.7",
        "laminas/laminas-mvc": "^3.2.0",
        "laminas/laminas-server": "^2.6.1",
        "laminas/laminas-servicemanager": "^3.6.0",
        "laminas/laminas-session": "^2.10",
        "laminas/laminas-soap": "^2.9.0",
        "laminas/laminas-stdlib": "^3.2.1",
        "laminas/laminas-text": "^2.6.0",
        "laminas/laminas-uri": "^2.5.1",
        "laminas/laminas-validator": "^2.6.0",
        "laminas/laminas-view": "~2.12.0",
        "league/flysystem": "^2.0",
        "league/flysystem-aws-s3-v3": "^2.0",
        "lib-libxml": "*",
        "magento/adobe-ims": "2.1.2",
        "magento/adobe-stock-integration": "2.1.2-p1",
        "magento/composer": "1.6.0",
        "magento/framework": "103.0.3-p1",
        "magento/framework-amqp": "100.4.1",
        "magento/framework-bulk": "101.0.0",
        "magento/framework-message-queue": "100.4.3",
        "magento/google-shopping-ads": "4.0.1",
        "magento/inventory-metapackage": "1.2.3-p1",
        "magento/language-de_de": "100.4.0",
        "magento/language-en_us": "100.4.0",
        "magento/language-es_es": "100.4.0",
        "magento/language-fr_fr": "100.4.0",
        "magento/language-nl_nl": "100.4.0",
        "magento/language-pt_br": "100.4.0",
        "magento/language-zh_hans_cn": "100.4.0",
        "magento/magento-composer-installer": ">=0.1.11",
        "magento/magento2-base": "2.4.3-p1",
        "magento/module-admin-analytics": "100.4.3-p1",
        "magento/module-admin-notification": "100.4.2",
        "magento/module-advanced-pricing-import-export": "100.4.3",
        "magento/module-advanced-search": "100.4.1",
        "magento/module-amqp": "100.4.1",
        "magento/module-amqp-store": "100.4.1",
        "magento/module-analytics": "100.4.3",
        "magento/module-asynchronous-operations": "100.4.3",
        "magento/module-authorization": "100.4.3",
        "magento/module-aws-s3": "100.4.1-p1",
        "magento/module-backend": "102.0.3",
        "magento/module-backup": "100.4.3",
        "magento/module-bundle": "101.0.3",
        "magento/module-bundle-graph-ql": "100.4.3",
        "magento/module-bundle-import-export": "100.4.2",
        "magento/module-cache-invalidate": "100.4.1",
        "magento/module-captcha": "100.4.3-p1",
        "magento/module-cardinal-commerce": "100.4.1",
        "magento/module-catalog": "104.0.3-p1",
        "magento/module-catalog-analytics": "100.4.1",
        "magento/module-catalog-cms-graph-ql": "100.4.0",
        "magento/module-catalog-customer-graph-ql": "100.4.3",
        "magento/module-catalog-graph-ql": "100.4.3",
        "magento/module-catalog-import-export": "101.1.3",
        "magento/module-catalog-inventory": "100.4.3",
        "magento/module-catalog-inventory-graph-ql": "100.4.0",
        "magento/module-catalog-rule": "101.2.3",
        "magento/module-catalog-rule-configurable": "100.4.2",
        "magento/module-catalog-rule-graph-ql": "100.4.1",
        "magento/module-catalog-search": "102.0.3",
        "magento/module-catalog-url-rewrite": "100.4.3",
        "magento/module-catalog-url-rewrite-graph-ql": "100.4.2",
        "magento/module-catalog-widget": "100.4.3",
        "magento/module-checkout": "100.4.3-p1",
        "magento/module-checkout-agreements": "100.4.2",
        "magento/module-checkout-agreements-graph-ql": "100.4.0",
        "magento/module-cms": "104.0.3-p1",
        "magento/module-cms-graph-ql": "100.4.1",
        "magento/module-cms-url-rewrite": "100.4.2",
        "magento/module-cms-url-rewrite-graph-ql": "100.4.1",
        "magento/module-compare-list-graph-ql": "100.4.0",
        "magento/module-config": "101.2.3",
        "magento/module-configurable-import-export": "100.4.1",
        "magento/module-configurable-product": "100.4.3",
        "magento/module-configurable-product-graph-ql": "100.4.3",
        "magento/module-configurable-product-sales": "100.4.1",
        "magento/module-contact": "100.4.3",
        "magento/module-cookie": "100.4.3",
        "magento/module-cron": "100.4.3",
        "magento/module-csp": "100.4.2-p1",
        "magento/module-currency-symbol": "100.4.2",
        "magento/module-customer": "103.0.3-p1",
        "magento/module-customer-analytics": "100.4.1",
        "magento/module-customer-downloadable-graph-ql": "100.4.0",
        "magento/module-customer-graph-ql": "100.4.3",
        "magento/module-customer-import-export": "100.4.3",
        "magento/module-deploy": "100.4.3",
        "magento/module-developer": "100.4.3",
        "magento/module-dhl": "100.4.2",
        "magento/module-directory": "100.4.3",
        "magento/module-directory-graph-ql": "100.4.1",
        "magento/module-downloadable": "100.4.3",
        "magento/module-downloadable-graph-ql": "100.4.3",
        "magento/module-downloadable-import-export": "100.4.2",
        "magento/module-eav": "102.1.3",
        "magento/module-eav-graph-ql": "100.4.1",
        "magento/module-elasticsearch": "101.0.3",
        "magento/module-elasticsearch-6": "100.4.3",
        "magento/module-elasticsearch-7": "100.4.3",
        "magento/module-email": "101.1.3",
        "magento/module-encryption-key": "100.4.2",
        "magento/module-fedex": "100.4.2",
        "magento/module-gift-message": "100.4.2",
        "magento/module-gift-message-graph-ql": "100.4.1",
        "magento/module-google-adwords": "100.4.1",
        "magento/module-google-analytics": "100.4.0",
        "magento/module-google-optimizer": "100.4.2",
        "magento/module-graph-ql": "100.4.3",
        "magento/module-graph-ql-cache": "100.4.0",
        "magento/module-grouped-catalog-inventory": "100.4.0",
        "magento/module-grouped-import-export": "100.4.1",
        "magento/module-grouped-product": "100.4.3",
        "magento/module-grouped-product-graph-ql": "100.4.3",
        "magento/module-import-export": "101.0.3",
        "magento/module-indexer": "100.4.3",
        "magento/module-instant-purchase": "100.4.2",
        "magento/module-integration": "100.4.3",
        "magento/module-jwt-framework-adapter": "100.4.0",
        "magento/module-layered-navigation": "100.4.3",
        "magento/module-login-as-customer": "100.4.3",
        "magento/module-login-as-customer-admin-ui": "100.4.3-p1",
        "magento/module-login-as-customer-api": "100.4.2",
        "magento/module-login-as-customer-assistance": "100.4.2-p1",
        "magento/module-login-as-customer-frontend-ui": "100.4.3-p1",
        "magento/module-login-as-customer-graph-ql": "100.4.0",
        "magento/module-login-as-customer-log": "100.4.2-p1",
        "magento/module-login-as-customer-page-cache": "100.4.3-p1",
        "magento/module-login-as-customer-quote": "100.4.2-p1",
        "magento/module-login-as-customer-sales": "100.4.3-p1",
        "magento/module-marketplace": "100.4.2",
        "magento/module-media-content": "100.4.2",
        "magento/module-media-content-api": "100.4.2",
        "magento/module-media-content-catalog": "100.4.2",
        "magento/module-media-content-cms": "100.4.2",
        "magento/module-media-content-synchronization": "100.4.2",
        "magento/module-media-content-synchronization-api": "100.4.1",
        "magento/module-media-content-synchronization-catalog": "100.4.1",
        "magento/module-media-content-synchronization-cms": "100.4.1",
        "magento/module-media-gallery": "100.4.2-p1",
        "magento/module-media-gallery-api": "101.0.2",
        "magento/module-media-gallery-catalog": "100.4.1",
        "magento/module-media-gallery-catalog-integration": "100.4.1-p1",
        "magento/module-media-gallery-catalog-ui": "100.4.1-p1",
        "magento/module-media-gallery-cms-ui": "100.4.1-p1",
        "magento/module-media-gallery-integration": "100.4.2",
        "magento/module-media-gallery-metadata": "100.4.1",
        "magento/module-media-gallery-metadata-api": "100.4.0",
        "magento/module-media-gallery-renditions": "100.4.1-p1",
        "magento/module-media-gallery-renditions-api": "100.4.0",
        "magento/module-media-gallery-synchronization": "100.4.2",
        "magento/module-media-gallery-synchronization-api": "100.4.1",
        "magento/module-media-gallery-synchronization-metadata": "100.4.0",
        "magento/module-media-gallery-ui": "100.4.2-p1",
        "magento/module-media-gallery-ui-api": "100.4.1",
        "magento/module-media-storage": "100.4.2-p1",
        "magento/module-message-queue": "100.4.3",
        "magento/module-msrp": "100.4.2",
        "magento/module-msrp-configurable-product": "100.4.1",
        "magento/module-msrp-grouped-product": "100.4.1",
        "magento/module-multishipping": "100.4.3",
        "magento/module-mysql-mq": "100.4.1",
        "magento/module-new-relic-reporting": "100.4.1",
        "magento/module-newsletter": "100.4.3-p1",
        "magento/module-newsletter-graph-ql": "100.4.0",
        "magento/module-offline-payments": "100.4.2",
        "magento/module-offline-shipping": "100.4.2",
        "magento/module-page-cache": "100.4.3",
        "magento/module-payment": "100.4.3",
        "magento/module-paypal": "101.0.3-p1",
        "magento/module-paypal-captcha": "100.4.1",
        "magento/module-paypal-graph-ql": "100.4.1",
        "magento/module-persistent": "100.4.3",
        "magento/module-product-alert": "100.4.2",
        "magento/module-product-video": "100.4.3",
        "magento/module-quote": "101.2.3",
        "magento/module-quote-analytics": "100.4.3",
        "magento/module-quote-bundle-options": "100.4.0",
        "magento/module-quote-configurable-options": "100.4.0",
        "magento/module-quote-downloadable-links": "100.4.0",
        "magento/module-quote-graph-ql": "100.4.3",
        "magento/module-related-product-graph-ql": "100.4.1",
        "magento/module-release-notification": "100.4.1",
        "magento/module-remote-storage": "100.4.1-p1",
        "magento/module-reports": "100.4.3",
        "magento/module-require-js": "100.4.0",
        "magento/module-review": "100.4.3",
        "magento/module-review-analytics": "100.4.1",
        "magento/module-review-graph-ql": "100.4.0",
        "magento/module-robots": "101.1.0",
        "magento/module-rss": "100.4.2",
        "magento/module-rule": "100.4.2",
        "magento/module-sales": "103.0.3-p1",
        "magento/module-sales-analytics": "100.4.1",
        "magento/module-sales-graph-ql": "100.4.3",
        "magento/module-sales-inventory": "100.4.0",
        "magento/module-sales-rule": "101.2.3",
        "magento/module-sales-sequence": "100.4.1",
        "magento/module-sample-data": "100.4.1",
        "magento/module-search": "101.1.3",
        "magento/module-security": "100.4.3-p1",
        "magento/module-send-friend": "100.4.2",
        "magento/module-send-friend-graph-ql": "100.4.0",
        "magento/module-shipping": "100.4.3",
        "magento/module-sitemap": "100.4.2",
        "magento/module-store": "101.1.3",
        "magento/module-store-graph-ql": "100.4.2",
        "magento/module-swagger": "100.4.2",
        "magento/module-swagger-webapi": "100.4.0",
        "magento/module-swagger-webapi-async": "100.4.0",
        "magento/module-swatches": "100.4.3",
        "magento/module-swatches-graph-ql": "100.4.2",
        "magento/module-swatches-layered-navigation": "100.4.0",
        "magento/module-tax": "100.4.3",
        "magento/module-tax-graph-ql": "100.4.0",
        "magento/module-tax-import-export": "100.4.3",
        "magento/module-theme": "101.1.3-p1",
        "magento/module-theme-graph-ql": "100.4.1",
        "magento/module-translation": "100.4.3",
        "magento/module-ui": "101.2.3-p1",
        "magento/module-ups": "100.4.3",
        "magento/module-url-rewrite": "102.0.2",
        "magento/module-url-rewrite-graph-ql": "100.4.2",
        "magento/module-user": "101.2.3",
        "magento/module-usps": "100.4.2",
        "magento/module-variable": "100.4.1-p1",
        "magento/module-vault": "101.2.3-p1",
        "magento/module-vault-graph-ql": "100.4.0",
        "magento/module-version": "100.4.0",
        "magento/module-webapi": "100.4.2",
        "magento/module-webapi-async": "100.4.1",
        "magento/module-webapi-security": "100.4.1",
        "magento/module-weee": "100.4.3",
        "magento/module-weee-graph-ql": "100.4.1",
        "magento/module-widget": "101.2.3",
        "magento/module-wishlist": "101.2.3-p1",
        "magento/module-wishlist-analytics": "100.4.2",
        "magento/module-wishlist-graph-ql": "100.4.3",
        "magento/page-builder": "1.7.0-p1",
        "magento/security-package": "1.1.2",
        "magento/theme-adminhtml-backend": "100.4.3-p1",
        "magento/theme-frontend-blank": "100.4.3",
        "magento/theme-frontend-luma": "100.4.3",
        "magento/zendframework1": "~1.14.2",
        "monolog/monolog": "^1.17",
        "paragonie/sodium_compat": "^1.6",
        "paypal/module-braintree": "4.2.5",
        "pelago/emogrifier": "^5.0.0",
        "php": "~7.3.0||~7.4.0",
        "php-amqplib/php-amqplib": "~2.10.0",
        "phpseclib/mcrypt_compat": "1.0.8",
        "phpseclib/phpseclib": "2.0.*",
        "ramsey/uuid": "~4.1.0",
        "symfony/console": "~4.4.0",
        "symfony/event-dispatcher": "~4.4.0",
        "symfony/process": "~4.4.0",
        "tedivm/jshrink": "~1.4.0",
        "temando/module-shipping": "2.0.0",
        "tubalmartin/cssmin": "4.1.1",
        "vertexinc/product-magento-module": "4.2.2",
        "web-token/jwt-framework": "^v2.2.7",
        "webonyx/graphql-php": "^0.13.8",
        "wikimedia/less.php": "^3.0.0",
        "yotpo/magento2-module-yotpo-reviews-bundle": "3.2.0"
    },
    "type": "metapackage",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "description": "eCommerce Platform for Growth (Community Edition)"
}

As you can see magento/product-community-edition currently requires a specific version of klarna/m2-payments:

"klarna/m2-payments": "8.3.6",

So when Klarna fixes the issue and creates a new release, then Magento will also need to create a new release, in order to fix this issue. And in my opinion, the dependency should be changed to:

-            "klarna/m2-payments": "8.3.6",
+            "klarna/m2-payments": "^8.3.7",

(once 8.3.7 is released, or whichever version Klarna chooses).

SamJUK commented 2 years ago

Is there any updates on a release for this, or atleast a patch file? We got a few production sites this is affecting.

EDIT: Remedy & patch can found at the following https://docs.klarna.com/platform-solutions/adobe-commerce/adobe-commerce-23x-243/notice-for-users-of-magento-v243/