OperationalError:光标“ _django_curs_< id>”不存在 [英] OperationalError: cursor "_django_curs_<id>" does not exist

查看:115
本文介绍了OperationalError:光标“ _django_curs_< id>”不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个在线商店的网络应用程序,由django,postgresql和heroku提供支持。

We have an online store web-app which is powered by django, postgresql and heroku.

对于一个特定的广告系列(您可以认为像要购买的产品这样的广告系列),我们已经成功销售了1万多本。根据我们的Sentry报告,我们的一些用户仍然遇到此错误。这些用户的通用规范是;他们都没有购买前的地址信息。通常,用户在注册后立即填写地址表格。如果没有,他们需要在购买产品时填写表格,然后一起提交。

For a specific campaign (you can think a campaign like a product to purchase), we have sold 10k+ copies successfully. Yet some of our users are encountered this error according to our Sentry reports. Common specification of these users is; none of them have address information before the purchase. Generally, users fill out address form right after registering. If they don't, they need to fill the form while purchasing the product and submit them together.

这是跟踪的样子:

OperationalError: cursor "_django_curs_140398688327424_146" does not exist

(66 additional frame(s) were not displayed)
...
  File "store/apps/store_main/templatetags/store_form_filters.py", line 31, in render_form
    return render_to_string('widgets/store_form_renderer.html', ctx)
  File "store/apps/store_main/templatetags/store_form_filters.py", line 20, in render_widget
    return render_to_string('widgets/store_widget_renderer.html', ctx)
  File "store/apps/store_main/widgets.py", line 40, in render
    attrs=attrs) + "<span class='js-select-support select-arrow'></span><div class='js-select-support select-arrow-space'><b></b></div>"

OperationalError: cursor "_django_curs_140398688327424_146" does not exist 

所以另一个奇怪的共同点事情是,失败之前sql查询之间有异常消息。您可以在下图中看到它:

So another weird common thing, there are exception messages between sql queries before the failure. You can see it in the image below:

如果它们有某种联系,我会添加它。可能还相关的是,收到此错误的用户是在批量发送邮件后立即尝试购买广告系列的用户。因此,大量的流量可能是我们还不确定的原因。

I'm adding it if they are somehow related. What may also be related is, the users who get this error are the users who tries to purchase the campaign right after a bulk mailing. So, extensive traffic might be the reason yet we are also not sure.

我们向Heroku询问了这个问题,因为他们托管的是postgres,但他们没有任何线索

We asked Heroku about the problem since they are hosting the postgres, yet they do not have any clue either.

我知道此错误的正式原因是尝试在提交后到达游标。由于它是在交易后销毁的,因此尝试到达它会导致此错误,但在我们的方案中我看不到此错误。我们没有以任何方式触摸光标。我想念什么?什么会产生此错误?怎么预防呢?任何想法将不胜感激。

I know the formal reason of this error is trying to reach the cursor after a commit. Since it is destroyed after transaction, trying to reach it cause this error yet I don't see this in our scenario. We are not touching the cursor in any way. What am I missing? What may produce this error? How to prevent it? Any ideas would be appreciated.

推荐答案

出现错误的原因可能是您向模型中添加了字段而忘记了进行迁移和

The reason for your error might be that you added fields to a model and forgot to makemigrations and migrate.

看看这个答案:在运行测试用例中时,我将收到以下错误:psycopg2.OperationalError:游标 _django_curs_140351416325888_23不存在

这篇关于OperationalError:光标“ _django_curs_&lt; id&gt;”不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆