New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add a socket timeout on cancel requests #603

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@tmgordeeva
Contributor

tmgordeeva commented Jul 11, 2016

When a query times out, PgStatement.cancel can get stuck in
connection.cancelQuery while synchronized on the Connection object. This can
block PgStatement.killTimerTask from completing, which resulted in these
connections getting stuck in an unusable stack in our connection pool.

This deadlock only reproduced for us under high load with intermittent DB connectivity.

Tanya Gordeeva
fix: add a socket timeout on cancel requests
When a query times out, PgStatement.cancel can get stuck in
connection.cancelQuery while synchronized on the Connection object. This can
block PgStatement.killTimerTask from completing, which resulted in these
connections getting stuck in an unusable stack in our connection pool.
@codecov-io

This comment has been minimized.

codecov-io commented Jul 11, 2016

Current coverage is 58.13%

Merging #603 into master will increase coverage by <.01%

@@             master       #603   diff @@
==========================================
  Files           148        148          
  Lines         15605      15608     +3   
  Methods           0          0          
  Messages          0          0          
  Branches       3089       3090     +1   
==========================================
+ Hits           9071       9073     +2   
  Misses         5304       5304          
- Partials       1230       1231     +1   

Powered by Codecov. Last updated by f6b176e...12702b5

@schlosna

This comment has been minimized.

Contributor

schlosna commented Jul 11, 2016

Hi @davecramer and @vlsi , I saw your earlier email about preparing a release -- is there a chance this would make it into the pgjdbc 9.4.1209 release? Note that one might specify the socketTimeout when using failover such as Amazon RDS Postgres and without this change pgjdbc will deadlock threads.

@vlsi

This comment has been minimized.

Member

vlsi commented Jul 12, 2016

@schlosna , I think something like this can be made in.

@vlsi

This comment has been minimized.

Member

vlsi commented Jul 12, 2016

@tmgordeeva , I wonder if we want to make "cancel timeout" configurable and/or enable several retries. Any real-life experience on that matter?

vlsi added a commit to vlsi/pgjdbc that referenced this pull request Jul 13, 2016

fix: add a socket timeout on cancel requests
The timeout is configurable through cancelSignalTimeout in seconds with defult value of 10 seconds

fixes pgjdbc#603

vlsi added a commit that referenced this pull request Jul 13, 2016

fix: add a socket timeout on cancel requests
The timeout is configurable through cancelSignalTimeout in seconds with defult value of 10 seconds

fixes #603

@vlsi vlsi closed this in ab2a6d8 Jul 13, 2016

zemian pushed a commit to zemian/pgjdbc that referenced this pull request Oct 6, 2016

fix: add a socket timeout on cancel requests
The timeout is configurable through cancelSignalTimeout in seconds with defult value of 10 seconds

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