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

Control.status() crashes when connecting without a host name #111

Closed
joerivanruth opened this issue Sep 16, 2022 · 0 comments · Fixed by #112
Closed

Control.status() crashes when connecting without a host name #111

joerivanruth opened this issue Sep 16, 2022 · 0 comments · Fixed by #112
Assignees

Comments

@joerivanruth
Copy link
Member

The following gives a BrokenPipeError: Server closed connection.

import pymonetdb.control

# This works
ctrl = pymonetdb.control.Control(hostname='localhost', passphrase='blabla')
print(ctrl.status('demo'))

# This doesn't
ctrl = pymonetdb.control.Control(passphrase='blabla')
print(ctrl.status('demo'))

The problem was introduced by #102 COPY INTO FROM CLIENT merged in version 1.6.0.
The test suite never found it because it does pass hostname to the Control constructor.

@joerivanruth joerivanruth self-assigned this Sep 16, 2022
joerivanruth added a commit to joerivanruth/pymonetdb that referenced this issue Sep 22, 2022
gijzelaerr pushed a commit that referenced this issue Sep 26, 2022
* Add tests for local control connections

To check for issue #111

* Handle local control connections properly again

For some reason, monetdbd does not use the block protocol for
connections over the unix domain socket with language == 'control'.

Earlier I removed the code that dealt with this because I thought
it wasn't used anymore.  Turns out it is.

* shutdown the socket after sending control command

After having sent the response to a control command, the server waits
for one full second before closing the connection.  It is actually
waiting for the client to send another command. This never happens
because because the control protocol is a one-shot protocol, but the
server does it anyway, probably because the same code is also used
for normal connections.

This means the client has to wait a full second before it knows it has
received the full response.

By shutting down the write side of the socket after sending the
command we let the server know no more commands are coming so it can
shut down the connection immediately.

This speeds up the test_control.py test significantly.

* Silence the checkers

* Pass the passphrase to TestLocalControl

* Fix permissions of monetdbd's .merovingian socket
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 a pull request may close this issue.

1 participant