Skip to content

The database file stay busy after db.close() #1842

@zeid0ne

Description

@zeid0ne

Issue Summary

I want to remove my sqlite3 database file with code but i have an 'Error: EBUSY: resource busy or locked'. I use sequelize. A big timeout (2sec) after the db.close doesnt change anything.

Thanks.

Steps to Reproduce

1) Init the database

this.db = new Sequelize({ dialect: 'sqlite', storage: this.dbPath, logging: false })

2) Do a query

const trx = await db.transaction()
await db.query(query, { transaction: trx })
await trx.commit()

3) Try to remove the database

if (this.db) await this.db.close()
if (fs.existsSync(dbPath)) fs.unlinkSync(dbPath)

Version

"sequelize": "6.37.7", "sqlite3": "5.1.7"

Node.js Version

v22.14.0

How did you install the library?

npm

I dont know if this is a sequelize or a sqlite3 bug so i created a mirror issue on sequelize repo. Thanks for all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions