djstripe.models.payment_methods.PaymentMethod.DoesNotExist: PaymentMethod matching query does not exist
SurajPysquad opened this issue · comments
Describe the bug
djstripe.models.payment_methods.PaymentMethod.DoesNotExist: PaymentMethod matching query does not exist.
error_data.txt
*To Reproduce
Software versions
- Dj-Stripe version: 2.7.3
- Python version: 3.10.12
- Django version: 4.2.2
- Stripe API version: 4.2.0
- Database type and version: postgres 14
@SurajPysquad Deadlock issues are a know problem. But these are usually not an issue in livemode
as the Stripe API retries a few times.
If you are able to consistently reproduce this then it is a problem. Please let us know.
@arnav13081994 on production server every day i have face this issues
File "/usr/local/lib/python3.10/site-packages/### djstripe/models/base.py", line 618, in create_from_stripe_object
instance = cls.stripe_objects.get(id=id)
File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 637, in get
raise self.model.DoesNotExist(
djstripe.models.billing.Subscription.DoesNotExist: Subscription matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.DeadlockDetected: deadlock detected
DETAIL: Process 20130 waits for ShareLock on transaction 1276574; blocked by process 20132.
Process 20132 waits for ShareLock on transaction 1276570; blocked by process 20130.
HINT: See server log for query details.
CONTEXT: while inserting index tuple (6,3) in relation "### djstripe_subscription_id_key"
File "/usr/local/lib/python3.10/site-packages/djstripe/models/base.py", line 618, in create_from_stripe_object
instance = cls.stripe_objects.get(id=id)
File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 637, in get
raise self.model.DoesNotExist(
djstripe.models.core.PaymentIntent.DoesNotExist: PaymentIntent matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.DeadlockDetected: deadlock detected
DETAIL: Process 20132 waits for ShareLock on transaction 1276572; blocked by process 20131.
Process 20131 waits for ShareLock on transaction 1276574; blocked by process 20132.
HINT: See server log for query details.
CONTEXT: while inserting index tuple (17,7) in relation "### djstripe_paymentintent_id_key"
File "/usr/local/lib/python3.10/site-packages/djstripe/models/base.py", line 618, in create_from_stripe_object
instance = cls.stripe_objects.get(id=id)
File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 637, in get
raise self.model.DoesNotExist(
djstripe.models.core.Charge.DoesNotExist: Charge matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.DeadlockDetected: deadlock detected
DETAIL: Process 10639 waits for ShareLock on transaction 1269645; blocked by process 10634.
Process 10634 waits for ShareLock on transaction 1269655; blocked by process 10639.
HINT: See server log for query details.
CONTEXT: while inserting index tuple (41,2) in relation "### djstripe_charge_id_key"
@SurajPysquad Do the webhooks eventually succeed?