Symfony app stuck when getting EntityManager Symfony app stuck when getting EntityManager symfony symfony

Symfony app stuck when getting EntityManager


It would seem that I misused the locking mechanism in Postgres. Indeed the task processing component is a long-running task, but given that it is Symfony command, Doctrine connection is being established as early as possible.

Now comes the tricky part: I used the LOCK TABLE statement to lock some tables away from concurrent access (EXCLUSIVE type). Without closing the connection (not entity manager), those locks are left intact, until I restart the command (every 10th task).

This was the root cause.

I am still investigating some edge-cases, but since I moved away to advisory locking, I had no more lock-ups.