Skip to content

Make pconnect cache keys thread-specific#1045

Merged
bimalkjha merged 2 commits intoibmdb:masterfrom
ManitoulinTransport:thread-safe-pconnect
Feb 18, 2026
Merged

Make pconnect cache keys thread-specific#1045
bimalkjha merged 2 commits intoibmdb:masterfrom
ManitoulinTransport:thread-safe-pconnect

Conversation

@zenflow
Copy link
Contributor

@zenflow zenflow commented Feb 17, 2026

Include thread id in the persistent connection cache key so pconnect entries are isolated per thread.
This prevents accidental cross-thread reuse of cached connections.
Add regression test for thread safety of persistent connections.

This is the PR welcomed by @bimalkjha here: #618 (comment)

Also:
Fix PyUnicode_FromFormat reference leaks in pconnect cache key construction
Ensure PID and thread-id temporary unicode objects are NULL-checked and decref'd after PyUnicode_Concat.
Prevents incremental memory growth in long-running workloads using persistent connections.


The new test passes, but I was unable to run the whole test suite to check for regressions, as I'm not able to create an isolated database instance.
Can someone run the whole test suite and confirm all pass?

Include thread id in the persistent connection cache key so pconnect entries are isolated per thread.
This prevents accidental cross-thread reuse of cached connections.
Add regression test for thread safety of persistent connections.
…uction

- Ensure PID and thread-id temporary unicode objects are NULL-checked and decref'd after PyUnicode_Concat.
- Prevents incremental memory growth in long-running workloads using persistent connections.
@bimalkjha bimalkjha merged commit 705ca06 into ibmdb:master Feb 18, 2026
7 of 8 checks passed
@zenflow
Copy link
Contributor Author

zenflow commented Feb 19, 2026

Thank you @bimalkjha for reviewing and merging this PR! (And the other one, #1044)

Do you know when you can cut a release including these changes?

Thanks!

@bimalkjha
Copy link
Member

bimalkjha commented Feb 20, 2026

@zenflow We are waiting for few more changes to be merged which are in final stage in our pipeline. We'll have a new release in March. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments