Closed InternetMedicineMan closed 3 years ago
Experiencing similar issues on Magento 2.4.1, why was this issue closed? As it is obviously still unresolved (based on the comments and experience).
Seems this issue has been closed by mistake Reopen it not fixed yet
Hi here! I have investigated an issue a little bit, agree that it's really hard to reproduce it, but I found steps to reproduce with some direct changes in the DB. And thank you guys for your comments, it helped a lot!
So, the following steps may help you to reproduce the issue:
Configure persistent shopping cart with the following settings
Create a new customer and define default shipping and billing addresses.
Log out
Log in with "Remember me" checkbox applied.
Go to customer_entity
DB table and change default_billing
and default_shipping
ids to not existing ones.
Log out
You will get a No such entity with addressId =
error, caused by an exception in https://github.com/magento/magento2/blob/a31f4a35c018ad09654e5bd5871086b73fbd3d2d/app/code/Magento/Persistent/Observer/EmulateCustomerObserver.php#L90
To be honest, I don't know what caused the incorrect address id in the table, probably during the order submission process something went wrong, and customer addresses weren't saved, but the customer model has been updated at this moment.
So, the easy fix is to wrap https://github.com/magento/magento2/blob/a31f4a35c018ad09654e5bd5871086b73fbd3d2d/app/code/Magento/Persistent/Observer/EmulateCustomerObserver.php#L90 call into the try-catch block and update customer record/ignore incorrect address id.
The proper fix is to identify the root cause of the incorrect address ids and handle it to avoid incorrect data in DB at all.
The issue was investigated and prioritized today during a public triage meeting.
:white_check_mark: Confirmed by @sdzhepa
Thank you for verifying the issue. Based on the provided information internal tickets MC-39765
were created
Issue Available: @sdzhepa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
@magento i am working on it
Hi @InternetMedicineMan, @zakdma.
Thank you for your report and collaboration!
The related internal Jira ticket MC-39765
was closed as Fixed
.
The fix will be available with the upcoming 2.4.3
release.
@magento i am working on it
Hey, can I get the changes you have done for this because I'm facing the same issue on my site. magento version 2.3.5-p2 EE
Hi @rtshshukla! :wave:
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team
command to join Contributors team.
@rtshshukla, you can often use github's search functionality to find commits related to that ticket number they mentioned before, like this: https://github.com/magento/magento2/search?q=MC-39765&type=commits
Hope this helps 🙂
We're experiencing this after upgrading from 2.3.0 CE to 2.3.6 CE. I don't see any Persistent settings in our admin section, confused why there would be a persistent issue when it seems Persistent is no longer on CE? Or am I wrong?
Why is this closed? We updated the file EmulateCustomerObserver.php with the latest file and that still has not corrected the issue.
Do we first need to run the Db query to clear the tables?
This is happening on a live site to customers all day. Anyone?
It seems to happen to logged in users when they have neither default billing address nor do they have default shipping address.
@sdzhepa @zakdma Can you share commit related with PR for the fix ? cc: @duckchip can this issue reproducible in 2.4-develop
@mrtuvn: Commits tagged with MC-39765: https://github.com/magento/magento2/search?q=MC-39765&type=commits (I already mentioned this 4 posts ago 😉 )
@nickpiro, the Persistent module is definitely still a default Magento module in 2.3.6 (make sure you didn't disable this module in your app/etc/config.php
file or removed it with a replace
trick in your composer.json
file)
oh i don't recognise that! Thank you for mention Btw not sure this problem can be experience or present again after apply fixes in 2.4.2, 2.4.1?
Is there a patch for previous versions of magento? I see there are 7 commits with multiple modified files. What is the complete solution for this regarding previous versions of magento?
@broadmargin: there seem to be 2 merge commits:
The second one only contains some minor changes to a unit test. If you don't care about unit tests, you will probably have enough with the first commit and can make a patch out of that one commit.
Or alternatively, you could try to setup a clone of the magento2 git repo, checking out the tag of the Magento version you are working on, and then cherry-picking with the -n
flag, the following non-merge commits (and manually solving merge conflicts if you run into them):
And then creating a patch out of the uncommited changes, which should result in the same patch as those merge commits.
We've been having an issue on our 2.2.3 installation in Production. On occasion a visitor will report they have this System Log Generated error show up instead of the web page. I've managed to get it myself just a couple times. Every single time when you go to the filesystem and check the report it reports the following:
{"0":"No such entity with addressId = 45879","1":"#0 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-customer\/Model\/AddressRegistry.php(49): Magento\Framework\Exception\NoSuchEntityException::singleField('addressId', '45879')
1 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-customer\/Model\/ResourceModel\/AddressRepository.php(166): Magento\Customer\Model\AddressRegistry->retrieve('45879')
2 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-persistent\/Observer\/EmulateCustomerObserver.php(105): Magento\Customer\Model\ResourceModel\AddressRepository->getById('45879')
</end Fragment>
The addressID is different every time. And the only way to fix it for that person, is to just clear the cookies. Once you clear your cookies for the domain everything works perfectly fine again. It almost seems like something on the cookies is getting corrupt. It's pretty rare that it happens but we have a busy store, so rare is still 2-5 times a day.
Preconditions
Steps to reproduce
I have not managed to figure out reliable steps to reproduce. Appears to be random
Expected result
Actual result
{"0":"No such entity with addressId = 45879","1":"#0 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-customer\/Model\/AddressRegistry.php(49): Magento\Framework\Exception\NoSuchEntityException::singleField('addressId', '45879')\n#1 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-customer\/Model\/ResourceModel\/AddressRepository.php(166): Magento\Customer\Model\AddressRegistry->retrieve('45879')\n#2 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-persistent\/Observer\/EmulateCustomerObserver.php(105): Magento\Customer\Model\ResourceModel\AddressRepository->getById('45879')\n#3 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Event\/Invoker\/InvokerDefault.php(72): Magento\Persistent\Observer\EmulateCustomerObserver->execute(Object(Magento\Framework\Event\Observer))\n#4 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Event\/Invoker\/InvokerDefault.php(60): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Persistent\Observer\EmulateCustomerObserver), Object(Magento\Framework\Event\Observer))\n#5 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Event\/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))\n#6 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/generated\/code\/Magento\/Framework\/Event\/Manager\/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('controller_acti...', Array)\n#7 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/App\/Action\/Action.php(96): Magento\Framework\Event\Manager\Proxy->dispatch('controller_acti...', Array)\n#8 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))\n#9 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\Cms\Controller\Index\Index\Interceptor->callParent('dispatch', Array)\n#10 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#11 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/generated\/code\/Magento\/Cms\/Controller\/Index\/Index\/Interceptor.php(39): Magento\Cms\Controller\Index\Index\Interceptor->callPlugins('dispatch', Array, Array)\n#12 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/App\/FrontController.php(55): Magento\Cms\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#13 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))\n#14 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->callParent('dispatch', Array)\n#15 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-store\/App\/FrontController\/Plugin\/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#16 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n#17 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/module-page-cache\/Model\/App\/FrontController\/BuiltinPlugin.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#18 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n#19 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#20 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->callPlugins('dispatch', Array, NULL)\n#21 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/App\/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#22 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php(24): Magento\Framework\App\Http->launch()\n#23 \/chroot\/home\/wonderci\/retailer.wondercide.com\/html\/vendor\/magento\/framework\/App\/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()\n#24 \/chroot\/home\/wonderci\/wondercide.com\/html\/index.php(43): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#25 {main}","url":"\/","script_name":"\/index.php"}
Additional Information
The issue is not trivial and reproducible only in specific condition(s) or situation. Here is the summary based investigation and comments