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

Destroy lost connection objects acquired from mysql.connect() #31

Closed
Totktonada opened this issue Nov 22, 2019 · 2 comments · Fixed by #49
Closed

Destroy lost connection objects acquired from mysql.connect() #31

Totktonada opened this issue Nov 22, 2019 · 2 comments · Fixed by #49
Assignees
Labels
bug Something isn't working prio5

Comments

@Totktonada
Copy link
Member

Totktonada commented Nov 22, 2019

When a connection is acquired from a pool, lost and collected by Lua GC, its underlying connection will be closed from a GC callback. A connection that is created directly w/o a pool using mysql.connect() has no such GC callback, so its underlying connection will not be properly closed if a user does not call <connection object>:close() manually.

A fiber may store a connection in its local variable. If this fiber does not handle abnormal exit properly and, say, does not close the connection when is hit by fiber.cancel(), the underlying connection will leak.

We should test than the underlying connection is closed in the case.

@romanhabibov
Copy link
Contributor

I've checked. Connection doesn't leak actually. lua_mysql_gc(struct lua_State *L) is called with collectgarbadge(). The ticket isn't relevant.

lua_mysql_gc(struct lua_State *L)

@Totktonada
Copy link
Member Author

How about a test that checks that a file descriptor actually closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working prio5
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants