开发者

django shell triggering Postgres idle transaction problems

It's not the fault of the django (iPython) shell, actually. The problem is developers who open the django shell ./manage.py shell run through some queries (it often only generates selects), and then either leave the shell running or somehow kill their (ssh) session (actually, I'm not sure if the latter case leaves the transaction open - I haven't tested it)

In any case, nagios regularly alerts over these idle transactions. We could, of course call developer.stop_doing_that_dammit() but it's unreliable.

I'm looking for thoughts on resolving this in a way that all开发者_如何学Goows developers to use the django shell, but closes transactions should they forget to close their session out.


You may always run a cron job, that will call pg_cancel_backend() within the database, for the backends that are idle for longer than e.g. 1 day (of course that depends on the nagios settings).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜