typelevel / typelevel/skunk

Race conditions accidentally create nested transactions (and fail)

Open
#685 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.7k
Forks
175
Avg merge
5d 14h
Merged PRs (30d)
9

Description

(discord: https://discord.com/channels/632277896739946517/839844929877704785/999575181624352839)

Let's say, I have a function that does some queries in a transaction. Now, I connect to postgres with only a single connection. Then, I'm executing the function 10 times in parallel. What will happen?

Ideally, there is a Semaphore that serializes the execution of these 10 function calls.

But what's actually happening is, that you'll get a nested transaction error from skunk.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the issue. Start by reproducing ten parallel calls to a transactional function over one PostgreSQL connection, then trace the transaction and connection-handling entry points. Done means concurrent calls are serialized and no nested transaction error occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres, scala
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.