-
Notifications
You must be signed in to change notification settings - Fork 37
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
Pyzeebe will never time out a connection to a gateway with problems #178
Comments
After some experimenting it seems that this: def _create_channel(connection_uri: str, credentials: BaseCredentials = None,
secure_connection: bool = False) -> grpc.Channel:
options = (
("grpc.keepalive_time_ms", 45000),
("grpc.keepalive_timeout_ms", 120000),
("grpc.http2.min_time_between_pings_ms", 60000)
)
if credentials:
return grpc.secure_channel(connection_uri, credentials.grpc_credentials, options=options)
elif secure_connection:
return grpc.secure_channel(connection_uri, grpc.ssl_channel_credentials(), options=options)
else:
return grpc.insecure_channel(connection_uri, options=options) would fix it. Do we want these to be changed? Both the java and go clients allow this, but the node client does not. |
What about allowing to monkeypatch it if the user wants to change it? We could define from pyzeebe.grpc import GRPC_CHANNEL_OPTIONS
GRPC_CHANNEL_OPTIONS.update("grpc.keepalive_time_ms": 5000) With regards to |
I can add this in a PR, though not sure how to test this (except testing that default values, monkeypatching works). |
@JonatanMartens See PR. Let me know if you would like this ported to 3.0 branch as well - I see that I can do it quite similarly.
def create_channel(
connection_uri: str,
credentials: Optional[BaseCredentials] = None,
secure_connection: bool = False
) -> grpc.aio.Channel:
options = get_channel_options()
if credentials:
return grpc.aio.secure_channel(connection_uri, credentials.grpc_credentials, options=options)
if secure_connection:
return grpc.aio.secure_channel(connection_uri, grpc.ssl_channel_credentials(), options=options)
return grpc.aio.insecure_channel(connection_uri, options=options)
|
That would be appreciated.
Good idea! |
I'll keep this issue open until we also fix the 3.0.0 branch. |
Describe the bug
If the gateway fails in a certain way, while a connection has been opened to it, Pyzeebe will not time out.
The issue applies both to the client, and the worker.
For the worker, the issue is noticed by it hanging, if it experience loss of connectivity to gateway.
To Reproduce
Start the gateway and brokes (use https://github.com/camunda-community-hub/zeebe-docker-compose/blob/0.26.0/standalone-gateway/docker-compose.yml) – don't run any workers against this cluster.
docker-compose up -d
In a second terminal, run the following code:
After a few seconds, pause the broker, using
docker-compose pause gateway
What you'll see is that the client waits forever (actually 2 hours) since the broker has gone down:
The reason being that the
timeout
argument is for the server side, and not the client-side. Expected behavior
If connection to the gateway is lost, Pyzeebe should detect this and throw an error (or retry connection).
Version
Pyzeebe: 0.26.4
Zeebe: 0.26.0
Additional context
https://github.com/grpc/grpc/blob/0e20a5fce8e53510255fa1a5199544a86ebfcd8e/src/core/ext/transport/chttp2/transport/chttp2_transport.cc#L65-L70
DEFAULT_SERVER_KEEPALIVE_TIME_MS
) before trying to check if the server is still upThis has been solved in the official clients:
node.js:
C#:
The text was updated successfully, but these errors were encountered: