Skip to content

Close the connection properly#37

Merged
ueshin merged 2 commits into
databricks:mainfrom
ueshin:close_conn
Jan 27, 2022
Merged

Close the connection properly#37
ueshin merged 2 commits into
databricks:mainfrom
ueshin:close_conn

Conversation

@ueshin

@ueshin ueshin commented Jan 26, 2022

Copy link
Copy Markdown
Contributor

resolves #34

Description

Closes the connection properly.

logger.debug(
"Exception while closing cursor: {}".format(exc)
)
self._conn.close()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether this is also needed in dbt-spark.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtcohen6 Is it fine in dbt-spark? I suspect it has the same issue without any notice.

@jtcohen6 jtcohen6 Jan 26, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Came here because I was seeing the same unclosed socket error as in #34. Tried the fix in this PR, worked like a charm! Then I saw I was tagged...

This isn't an issue we've noticed with the dbt-spark connector — but that's not so surprising to me, different cursors are liable to behave differently. Even with the change in #35, which will allow dbt-databricks to inherit (and avoid reimplementing) common functionality from dbt-spark, I would expect these methods to be points of departure

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks for confirming!

@danielhaviv danielhaviv Jan 30, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtcohen6 I can confirm I'm experiencing an issue with unclosed connections with dbt-spark and the fix is needed there as well. opened an issue on dbt-spark #280

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielhaviv Thanks for opening the issue!

@superdupershant superdupershant left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@ueshin

ueshin commented Jan 27, 2022

Copy link
Copy Markdown
Contributor Author

Thanks! merging.

@ueshin ueshin merged commit 43cc5b9 into databricks:main Jan 27, 2022
@ueshin ueshin deleted the close_conn branch January 27, 2022 22:37
ueshin added a commit to ueshin/dbt-databricks that referenced this pull request Jan 27, 2022
resolves databricks#34

### Description

Closes the connection properly.
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 this pull request may close these issues.

ResourceWarning: Unclosed SSLSocket

4 participants