question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Idle in transaction

See original GitHub issue

Hello, Database: postgresql 10

Yesterday I noticed, DBeaver leaves its internal queries in “idle in transaction” state. In this particular case those queries lasts for hours (until spotted by maintenance guys).

Here are queries mentioned queries:

SELECT e.typdelim FROM pg_catalog.pg_type t, pg_catalog.pg_type e WHERE t.oid = $1 and t.typelem = e.oid

SHOW search_path

Yesterday I was able to reproduce this issue using my home computer and DBeaver running on Windows10. It was caused by selecting database from Navigator, and clicking CTRL+] to open new tab connected to selected DB.

Unfortunately today I’m not able to reproduce it using Dbeaver running on Ubuntu (in both cases most recent version 7.0.1)

I’m going to check it at home again.

Anyway this is something which should not happen ever. So it’s very important to fix it.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
michalk-kcommented, May 18, 2020

I cannot decide about this too since I’m not the author of this application. The crucial message is: leaving session in idle in transaction state is considered unacceptable. A lot of properly configured systems is configured to kill such hanging connections after some short period of time. I’m not sure it does any good to DBeaver and user experience though.

I have two ideas:

  1. force separate connection for metadata if no auto-commit enabled
  2. the same as #1 but only if there is no opened transaction by a user.
  3. otherwise warn client that it will commit his transaction.

The point is that in current state, DBeaver opens transaction for meta data (so in the background) and leaves it opened even if no transaction has been opened by a user. The user cannot expect to commit something which is not opened by him.

with regards

3reactions
da-commented, Feb 4, 2021

+1 this is a dangerous situation; I’ve had to apologize to our production team because my “Idle in transaction” process stalled a nightly import operation.

Ironically, because I wanted the protection of manually committing update transactions.

I like @michalk-k 's suggestions for fixes. And this is exactly correct: “The user cannot expect to commit something which is not opened by him.”

How about:

  • If the user turns off auto-commit, warn the user we’re automatically turning on “separate connection for metadata read” to prevent long-lived idle transactions.
  • And if the user turns off “separate connection for metadata read”, warn them we’re automatically turning on auto-commit.
Read more comments on GitHub >

github_iconTop Results From Across the Web

What does it mean when a PostgreSQL process is "idle in ...
The PostgreSQL manual indicates that this means the transaction is open (inside BEGIN) and idle. It's most likely a user connected using the...
Read more >
SELECT 1 - idle in transaction - DBA Stack Exchange
idle in transaction means pretty much what it suggests: there is an open transaction doing nothing at the moment.
Read more >
Idle Transactions - pganalyze
Detects transactions that have been open with no activity (the idle in transaction state) for longer than the specified threshold of 1800 seconds...
Read more >
Avoiding idle-in-transaction connection states with SQLAlchemy
This state is known as an idle-in-transaction connection state and should be avoided as much as possible, because it blocks DB resources without ......
Read more >
How to Monitor PostgreSQL Connections - EDB
idle in transaction: This indicates the backend is in a transaction, but it is currently not doing anything and could be waiting for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found