Skip to content

Commit dbb50d5

Browse files
remove connection reference in gc
1 parent 2dcf906 commit dbb50d5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mysql/init.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ end
3030
-- channel put is immediate or pool is doomed.
3131
local CONN_GC_HOOK_TIMEOUT = 0
3232

33-
local function conn_gc_hook(pool, conn)
33+
local function conn_gc_hook(pool, conn_id)
3434
local success = pool.queue:put(POOL_EMPTY_SLOT, CONN_GC_HOOK_TIMEOUT)
3535
if not success then
3636
log.error('mysql pool %s internal queue unexpected state: there are no ' ..
3737
'empty slots, connection %s cannot be put back. It is likely ' ..
3838
'that someone had messed with pool.queue manually. Closing ' ..
39-
'the pool...', pool, conn)
39+
'the pool...', pool, conn_id)
4040
log.error(debug.traceback)
4141

4242
pool:close()
@@ -62,6 +62,7 @@ local function conn_get(pool, timeout)
6262
end
6363

6464
local conn = conn_create(mysql_conn)
65+
local conn_id = tostring(conn)
6566
-- we can use ffi gc to return mysql connection to pool
6667
conn.__gc_hook = ffi.gc(ffi.new('void *'),
6768
function(self)
@@ -71,7 +72,7 @@ local function conn_get(pool, timeout)
7172
-- * 2.5.1-105-gc690b3337
7273
-- * 2.4.2-89-g83037df15
7374
-- * 1.10.7-47-g8099cb053
74-
fiber.new(conn_gc_hook, pool, conn)
75+
fiber.new(conn_gc_hook, pool, conn_id)
7576
end)
7677
-- If the connection belongs to a connection pool, it must be returned to
7778
-- the pool when calling "close" without actually closing the connection.

0 commit comments

Comments
 (0)