close
The Wayback Machine - https://web.archive.org/web/20201014070110/https://github.com/dbcli/pgcli/issues/1190
Skip to content
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

connection with dsn raises 'could not send SSL negotiation packet: Resource temporarily unavailable' #1190

Open
Karmenzind opened this issue May 29, 2020 · 1 comment

Comments

@Karmenzind
Copy link

@Karmenzind Karmenzind commented May 29, 2020

Description

Some of my databases cannot be connected with pgcli -D <dsn> from several days ago.

[alias_dsn]
sdb = postgresql://postgres:[email protected]/scenedb

image

But pgcli -h <ip> -u xxx works:

image

And here are relavant logs from .config/pgcli/log:

2020-05-29 16:39:26,722 (148849/MainThread) pgcli.main ERROR - traceback: 'Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pgcli/main.py", line 562, in connect
    raise e
  File "/usr/lib/python3.8/site-packages/pgcli/main.py", line 549, in connect
    pgexecute = PGExecute(database, user, passwd, host, port, dsn, **kwargs)
  File "/usr/lib/python3.8/site-packages/pgcli/pgexecute.py", line 214, in __init__
    self.connect(database, user, password, host, port, dsn, **kwargs)
  File "/usr/lib/python3.8/site-packages/pgcli/pgexecute.py", line 254, in connect
    conn = psycopg2.connect(**conn_params)
  File "/usr/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
  File "/usr/lib/python3.8/site-packages/pgcli/pgexecute.py", line 39, in _wait_select
    state = conn.poll()
psycopg2.OperationalError: could not send SSL negotiation packet: Resource temporarily unavailable

Your environment

  • Please provide your OS and version information.
Linux oreo 5.4.40-1-MANJARO #1 SMP PREEMPT Sun May 10 14:17:40 UTC 2020 x86_64 GNU/Linux
  • Please provide your CLI version.
pgcli -v
Version: 3.0.0
  • What is the output of pip freeze command.
apparmor==2.13.4
appdirs==1.4.3
application-utility==1.3.2
arandr==0.1.10
asn1crypto==1.3.0
attrs==19.3.0
Automat==20.2.0
autopep8==1.5.2
bauh==0.9.3
Beaker==1.11.0
beautifulsoup4==4.9.1
bs4==0.0.1
btrfsutil==1.2.0
CacheControl==0.12.6
cffi==1.14.0
chardet==3.0.4
cli-helpers==2.0.1
click==7.1.1
colorama==0.4.3
configobj==5.0.6
constantly==15.1.0
contextlib2==0.6.0.post1
cryptography==2.9.2
deluge==2.0.4.dev23
distlib==0.3.0
distro==1.5.0
docopt==0.6.2
entrypoints==0.3
filelock==3.0.12
flake8==3.7.9
GeoIP==1.3.2
gufw==20.4.0
html5lib==1.0.1
httpie==2.1.0
humanize==0.5.1
hyperlink==19.0.0
idna==2.9
incremental==17.5.0
jeepney==0.4.3
keyring==21.2.0
lensfun==0.3.95
LibAppArmor==2.13.4
lit==0.10.0.dev0
louis==3.13.0
lxml==4.5.1
Mako==1.1.2
MarkupSafe==1.1.1
mccabe==0.6.1
msgpack==1.0.0
mycli==1.21.1
npyscreen==4.10.5
ordered-set==3.1.1
packaging==20.3
pacman-mirrors==4.16.4
pbr==5.4.5
pep517==0.8.2
pgcli==3.0.0
pgspecial==1.11.10
Pillow==6.2.1
ply==3.11
progress==1.5
prompt-toolkit==3.0.5
psutil==5.7.0
psycopg2==2.8.5
psycopg2-binary==2.8.5
pyaml==20.4.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.19.1
pycodestyle==2.5.0
pycparser==2.20
pyflakes==2.2.0
Pygments==2.6.1
PyGObject==3.36.1
PyHamcrest==1.9.0
PyMySQL==0.9.3
pyOpenSSL==19.1.0
pyparsing==2.4.7
PyQt5==5.14.2
PyQt5-sip==12.7.2
pysmbc==1.0.20
python-libtorrent==1.2.6
python-xapp==2.0.0
python-xlib==0.27
pytoml==0.1.21
pyxdg==0.26
PyYAML==5.3.1
ranger-fm==1.9.3
rencode==1.0.6
reportlab==3.5.42
requests==2.23.0
retrying==1.3.3
SecretStorage==3.1.2
service-identity==18.1.0
setproctitle==1.1.10
shadowsocks==3.0.0
six==1.14.0
soupsieve==2.0.1
speedtest-cli==2.1.2
sqlparse==0.3.1
stevedore==1.32.0
tabulate==0.8.7
team==1.0
terminaltables==3.1.0
toml==0.10.0
Twisted==20.3.0
ueberzug==18.1.5
ufw==0.36
urllib3==1.25.9
virtualenv==20.0.21
virtualenv-clone==0.5.4
virtualenvwrapper==4.8.4
wcwidth==0.1.9
webencodings==0.5.1
youtube-dl==2020.5.8
zope.interface==5.1.0

@fraoustin
Copy link
Contributor

@fraoustin fraoustin commented Jun 24, 2020

Hi

can you test the connection with the database by docker.

You run a base with

You write a Dockerfile file:

FROM postgres:12-alpine
RUN apk add --no-cache openssl
RUN /usr/bin/openssl req -new -text -passout pass:abcd -subj /CN=localhost -out /var/lib/postgresql/server.req
RUN /usr/bin/openssl rsa -in privkey.pem -passin pass:abcd -out /var/lib/postgresql/server.key
RUN /usr/bin/openssl req -x509 -in /var/lib/postgresql/server.req -text -key /var/lib/postgresql/server.key -out /var/lib/postgresql/server.crt
RUN chmod 400 /var/lib/postgresql/server.key
RUN chown postgres.postgres /var/lib/postgresql/server.key

you build and run the Dockerfile

docker build -t test .
docker run -d --name test -p 5432:5432 -e POSTGRES_PASSWORD=secret test -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key

you can test the connection, with a pgcli docker

docker run --rm -it dbcliorg/pgcli -h <YourIP> -p 5432 -U postgres -W 

you can test the connection, with your pgcli

pgcli -h <YourIP> -p 5432 -U postgres -W 

At home the connection is ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.