heroku / heroku-pg

this code is now in https://github.com/heroku/cli
ISC License
15 stars 17 forks source link

Sessions that have been open for an extended period of time can't close #211

Open mikehale opened 6 years ago

mikehale commented 6 years ago

Steps to reproduce:

$ heroku create --space ecosystem-staging
Creating app in space ecosystem-staging... done, ⬢ guarded-headland-32300
http://guarded-headland-32300.herokuapp.com/ | https://git.heroku.com/guarded-headland-32300.git
$  heroku addons:create heroku-postgresql:private-0 -a guarded-headland-32300                                                                                                                              2 ↵
Creating heroku-postgresql:private-0 on ⬢ guarded-headland-32300... $300/month
This database will be created in a private space.
The database should be available in 3-5 minutes.
! CAUTION: The database will be empty. If upgrading, you can transfer
!          data from another database with pg:copy.
This plan includes the HA feature. Read more about its tradeoffs at
https://devcenter.heroku.com/articles/heroku-postgres-ha
Use `heroku pg:wait` to track status.
postgresql-defined-35608 is being created in the background. The app will restart when complete...
Use heroku addons:info postgresql-defined-35608 to check creation progress
Use heroku addons:docs heroku-postgresql to view documentation
$ heroku pg:psql -a guarded-headland-32300
--> Connecting to postgresql-defined-35608
Expanded display is used automatically.
Timing is on.
psql (10.3, server 10.4 (Ubuntu 10.4-2.pgdg16.04+1))
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

guarded-headland-32300::DATABASE=> select pg_sleep(1800); \q
SSL SYSCALL error: EOF detected
The connection to the server was lost. Attempting reset: Succeeded.
Time: 599825.783 ms (09:59.826)

^C

This leaves the terminal in an unusable state... I can't quit psql, and I can't do anything in psql.

mikehale commented 6 years ago

This is what my ps tree looks like afterward:

 | |-+= 15701 mhale -zsh
 | | \-+= 02343 mhale bash /usr/local/bin/heroku pg:psql -a guarded-headland-32300
 | |   \-+- 02357 mhale bash /Users/mhale/.local/share/heroku/client/bin/heroku pg:psql -a guarded-headland-32300
 | |     \-+- 02362 mhale bash /Users/mhale/.local/share/heroku/client/bin/../7.0.92/bin/heroku pg:psql -a guarded-headland-32300
 | |       \--- 02371 mhale /Users/mhale/.local/share/heroku/client/7.0.92/bin/node /Users/mhale/.local/share/heroku/client/7.0.92/bin/run pg:psql -a guarded-headland-32300

running kill -9 02371 allows me to use the terminal again

mikehale commented 6 years ago

/cc @kwugirl

msakrejda commented 6 years ago

I'm guessing the ssh tunnel we establish dies due to inactivity (nothing happens on the wire while waiting for query results from a long-running query), but I'm not sure how to tweak our tunnel. Thanks for reporting; we'll take a look when we have a chance.