-
Notifications
You must be signed in to change notification settings - Fork 133
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
SNOW-1159847: Missing error event emissions #780
Comments
hi and thank you for submitting this issue with us. I believe we can try and tackle it in 2 parts:
You could try to address to either adding the Snowflake-specific keepalive mechanism or you could also decide to not keep the connections alive but instead turn on the generic-pool idle connection detection and eviction mechanism. You can find a working example for both in this comment. edit: also depending on the situaiton, isValidAsync() can be called perhaps to test whether a particular connection is good for sending Snowflake queries over it.
Anyways, this could be indeed considered an improvement request for the driver and we'll take a look and consider. |
Also actually we do seem to emit some events based on Connection events (loadcomplete, etc), including error on some events in row stream. Not everywhere across Connection though and it can be definitely reviewed. |
@sfc-gh-dszmolka Thanks for the update! I haven't read the code deeply enough to assert with confidence that a As for your pool usage remark, we use the Knex to build queries / manage the connection pool currently. We don't consider changing it for now since it's been working fine for us for the most part. The fix we applied on our end was changing the connection validity check from a simple truthy check here to use |
my bad on the Knex part; seeing the example from their readme
as it was somewhat similar to the options For the improvement effort of reviewing and improving events emitted from Connection, I'll keep this thread posted if we decide to take on the enhancement - this can take a while so thank you in advance for bearing with us. |
Hi! The SDK uses the Connection class as its default class and it extends
EventEmitter
. However, it does not actually behave like one as it does not emit any event, errors included. For instance, in heartbeat request errors, the SDK just logs them instead of emitting them. Shouldn't we be emitting internal errors through theEventEmitter
API? If not, why inherit it at all?For a concrete example of how the lack of error event emissions is a bit confusing, it created an issue on our end as we're using a Knex SF dialect to manage a connection pool and it relies on error events to dispose a connection (can be seen here). Since the SDK does not emit these events, the connection will stay in the pool even though it shouldn't since it is not usable. In the end, the connection was in a disconnected state and we ended up getting countless
Unable to perform operation using terminated connection
errors.It would be great if the class would forward the errors so the users can handle them!
The text was updated successfully, but these errors were encountered: