crystal-sqlite3 icon indicating copy to clipboard operation
crystal-sqlite3 copied to clipboard

Connection are not promptly closed when transactions are used, eventually leading to file descriptor exaustion.

Open shelvacu opened this issue 6 years ago • 1 comments

For easy reproduction, just run this and wait a bit:

require "sqlite3"

puts "PID is #{Process.pid}"

DB.open("sqlite3://./test-db-feel-free-to-delete-me.sqlite") do |db|
  db.exec("CREATE TABLE IF NOT EXISTS foo (bar)")

  loop do
    db.transaction do
      db.exec("INSERT INTO foo VALUES (1)")
    end
  end
end

The PID output is so that you can browse to /proc/$PID/fd and see the number of open file descriptors accumulate.

shelvacu avatar Jul 14 '17 11:07 shelvacu

Hi, Maybe this issue have been changed on latest version, please ask on Gitter or #crystal-lang about this.

faustinoaq avatar Nov 08 '17 03:11 faustinoaq