Skip to content

ActiveRecord connection sharing: queue_classic cause rails application hang  #321

@rioug

Description

@rioug

When ActiveRecord integration is enabled with QC_RAILS_DATABASE=true, queue_classic sometimes causes my rails application to hang, and I have to restart the application server to get it to work again. It seems to happen randomly, but is usually linked to an increase in activity. Unfortunately I haven't been able to reproduce the issue, it looks like a concurrency problem.

It looks like queue_classic was picking up a connection already used by Rails, causing a query to take a very long time (up to 20s) and fail. There was no specific increase in load on the database server, and it would happen with various query which were fine otherwise. The application would then hang, request were getting stuck to trying to get a database connection.

The problem went away when I switched to QC_DATABASE_URL. I suspect the issue is related to how queue_classic get a database connection out of the Rails connection pool, maybe related to :
317

Configuration :
ruby 2.4
Rails 4.2.11
queue_classic 3.1.0

Application is running on an amazon EC2 instance. Rails and QC are running on the same instance. QC is used to generated PDF.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions