Laravel - Lock wait timeout exceeded : <p>I have a lot of transactions in my code, and if an error occurs in executing in one of these transactions that doesn't trigger commit or rollback, then the database is locked and any subsequent attempts to access the database results in this:</p>

<p><code>production.ERROR: PDOException: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction in /home/forge/default/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390
</code></p>

<p>In the Controller:</p>

<pre><code>DB::beginTransaction();

try {
    //Code that uses exec() to process some images. &lt;-- If code breaks here, then the above error appears on subsequent requests.
    //Code that accesses the database
}
catch(\Exception $e){
    DB::rollback();
    throw $e;
}
DB::commit();
</code></pre>

<p>So even php artisan migrate:refresh or php artisan migrate:reset stops working as well. How should I go about fixing this?</p>
