Environment
- macOS 15 (arm64 / Apple Silicon)
- tuitube v0.1.1 darwin_arm64 release binary
- mpv and yt-dlp installed via Homebrew
Steps to reproduce
# download release tarball, extract, move binary to PATH
tuitube bootstrap --catalog /path/to/catalog.db
What happens
merging catalog from /tmp/catalog.db...
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [select]:
database/sql.(*DB).conn(...)
...
github.com/gitcoder89431/tuitube/internal/db.(*DB).seedDemoPlaylists(...)
internal/db/catalog.go:155
github.com/gitcoder89431/tuitube/internal/db.(*DB).MergeCatalogFull(...)
internal/db/catalog.go:120
Root cause
In seedDemoPlaylists (internal/db/catalog.go), the code opens a cursor with db.conn.Query("SELECT name FROM cat.demo_playlists") and then — while that cursor is still open — issues additional queries inside the loop (QueryRow, Exec). The DB is configured with SetMaxOpenConns(1), so the second query can't acquire a connection while the first cursor holds the only one → deadlock.
Fix
Drain all rows from the cursor into a []string slice, close the cursor, then do the per-name queries:
// collect names first, then close cursor before issuing more queries
var names []string
for rows.Next() { ... names = append(names, name) }
rows.Close()
for _, name := range names {
db.conn.QueryRow(...) // safe now, no open cursor
}
Expected
Bootstrap completes successfully and reports merged tracks/playlists.
Environment
Steps to reproduce
What happens
Root cause
In
seedDemoPlaylists(internal/db/catalog.go), the code opens a cursor withdb.conn.Query("SELECT name FROM cat.demo_playlists")and then — while that cursor is still open — issues additional queries inside the loop (QueryRow,Exec). The DB is configured withSetMaxOpenConns(1), so the second query can't acquire a connection while the first cursor holds the only one → deadlock.Fix
Drain all rows from the cursor into a
[]stringslice, close the cursor, then do the per-name queries:Expected
Bootstrap completes successfully and reports merged tracks/playlists.