-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Description
Laravel Version
12.12.0
PHP Version
8.3.20
Database Driver & Version
mariadb Ver 15.1 Distrib 10.6.21-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
Description
I'm using spatie/fork as the driver for concurrency in laravel, I started noticing severe crashes in scheduled tasks that uses concurrency e.g PDO errors, at first I thought it was an issue with my code, did a lot of refactoring, but still got the same problems.
Finally I decided to downgraded packages, I downgraded spatie/fork to v1.2.4 and everything started working as usual, in order to confirm that this was the issue, I upgraded and downgraded again. Same results, v1.2.5 errors, v1.2.4 stable.
v1.2.5
[2025-05-02 15:10:15] production.ERROR: SQLSTATE[HY093]: Invalid parameter number (Connection: mariadb, SQL: select * from `accounts` where exists (select * from `subscriptions` where `accounts`.`user_id` = `subscriptions`.`user_id` and `status` = active and `ends_at` > 2025-05-02 15:10:15)) {"exception":"[object] (Illuminate\\Database\\QueryException(code: HY093): SQLSTATE[HY093]: Invalid parameter number (Connection: mariadb, SQL: select * from `accounts` where exists (select * from `subscriptions` where `accounts`.`user_id` = `subscriptions`.`user_id` and `status` = active and `ends_at` > 2025-05-02 15:10:15))
Another error
SQLSTATE[HY093]: Invalid parameter number (Connection: mysql, SQL: select * from `farmers` where `id` = 77 limit 1)
v1.2.4
Everything went back to normal, why is it messing with PDO and mysql, what changed...
I have decided to go through the diff and I discovered the culprit..
https://github.com/spatie/fork/blob/0fe5055b39d4043c39cfe97e201e76d364424a55/src/Fork.php#L136
The function call:
posix_kill(getmypid(), SIGKILL);
After the introduction of this, things started crashing...
Steps To Reproduce
Simply running queries with bindings inside a background process.