To reproduce issue guaranteed put a breakpoint in Magento\CatalogInventory\Observer\QuantityValidatorObserver::execute method.
Issue is caused by duplicated session cookies send after session_regenerate_id() is called.
Possible related to PHP with Apache bug: https://bugs.php.net/bug.php?id=75554&edit=1
Duplicate of https://github.com/magento/magento2/issues/12362 ?
We have a similar issue on one our project.
Magento 2.2.4.
Fix from bug #12362 did not help to fix this issue (yes, it fixed log out after some quick reload on the checkout page, but not this issue)
Have someone any ideas how to catch and fix this intermittent issue?
Looks like, we found the reason. It's customer plugin for each action - https://github.com/magento/magento2/blob/2.2/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php
The most easly and fuster way to reproduce this issue is appling coupon on shopping cart page for logged in customer (sometimes you need to apply/cancel couplon several times).
Hello, @Gaboemmi, thank you for your report. Can you please specify, what browser do you use?
Magento 2.2.5 EE - I confirm, the same error.
Easiest way to reproduce is hitting F5 on checkout page several times.
Seems related to:
https://github.com/magento/magento2/issues/13889
https://github.com/magento/magento2/issues/12362
As I investigated, every time /checkout/index/index page is refreshed, it changes session ID (PHPSESSID). It does not happen on other pages. I've tried to remove
$this->_customerSession->regenerateId();
in Magento\Checkout\Controller\Index line 35
and it helped.
I really have no idea why is it here and what it's supposed to do.
This line came from version 0.1.0 and seems completely unnecessary here.

PS. I've even checked Magento 1 Mage_Checkout_OnepageController class to check if there was a line such like this. Nope. This one only appeared in Magento 2 without any corresponding issue.
@Gaboemmi, thank you for your bug report.
We've created internal ticket MAGETWO-93111t o track progress on the issue.
@agata-maksymiuk I followed your directions and this fixed my problem. The line has been commented out for now. hopefully, Magento 2 will remove this deprecated code that is causing issues. I did a clean upgrade to 2.2.5 and the issue is easily deprecated.
Hi @Gaboemmi.
Thank you for your report and collaboration!
The related internal Jira ticket MAGETWO-93861 was closed as non-reproducible in 2.2.x.
It means that Magento team either unable to reproduce this issue using provided _Steps to Reproduce_ from the _Description section_ on clean or the issue has been already fixed in the scope of other tasks.
But if you still run into this problem please update or provide additional information/steps/preconditions in the _Description section_ and reopen this issue.
Most helpful comment
Magento 2.2.5 EE - I confirm, the same error.
Easiest way to reproduce is hitting F5 on checkout page several times.
Seems related to:
https://github.com/magento/magento2/issues/13889
https://github.com/magento/magento2/issues/12362
As I investigated, every time /checkout/index/index page is refreshed, it changes session ID (PHPSESSID). It does not happen on other pages. I've tried to remove
$this->_customerSession->regenerateId();in Magento\Checkout\Controller\Index line 35
and it helped.
I really have no idea why is it here and what it's supposed to do.
This line came from version 0.1.0 and seems completely unnecessary here.
PS. I've even checked Magento 1 Mage_Checkout_OnepageController class to check if there was a line such like this. Nope. This one only appeared in Magento 2 without any corresponding issue.