So, that's what could be happening. Okay, so far, so good. Of course I will not use only one connection, I just thought the deadlock while the tasks where running could be the same as the one in startup, but as @jbarrez said, it is not.
Still, If I the thread number is higher or equal to the max connection pool size, I get a deadlock. That doesn't make sense at all, that's okay to get a bottleneck, but, if I do not set the max lifetime of a connection, the application freezes and never come back.
Is there a way to limit the tasks execution to the same number of connections in the pool? Because I will start processes from HTTP and from JMS, so, I cannot limit in the input. For example, If I have 30 connections, I want to limit Activiti to execute only 29 tasks in parallel, because I don't want to get borrow timeouts all the time, like we are getting right now if the number of tasks running is higher than the connection pool size.