Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks!
(Any non-English issues will be closed immediately.)
Please provide your PHP and Swoole version. (php -v and php --ri swoole)
php version: 7.3.10
swoole version: 4.4.12
Please provide your Laravel/Lumen version.
laravel version: 6.5.2
Which release version of this package are you using?
"swooletw/laravel-swoole": "^2.6",
What did you do? If possible, provide a recipe for reproducing the error.
when i start swoole for a few days , it return error with mysql connect , laravel return "message": "SQLSTATE[HY000]: General error: 2006 MySQL server has gone away, and i need to run php artisan swoole:http reload then it's ok .
What did you expect to see?
What did you see instead?
From other long running servers that use MySQL, this usually means a new MySQL connection needs to be set up. Often the object that you use to connect with the database has boolean which states that the last query had a problem, then the next query will re-connect.
I'm not sure if Laravel(-swoole) would do any of that, if you would just retry the query (DB::transaction() can do automatic retries).
@HenkPoley to be sure, Laravel it does:
@JamesKid can you reproduce your issue with these steps?
config/swoole_http.php, 'worker_num')Yes锛孖 HAVE the same question
The following detail is from Laravel's schedule in every minute.
PDOStatement::execute(): MySQL server has gone away (SQL: select * from `xxxx` where `freeze_end_time` < 2020-05-04 16:02:00 and `status` = 0 and `xxxx`.`delete_time` is null order by `id` asc limit 100 offset 0 for update)
This MySQL instance is used by other project锛宎nd running in good state.
PHP 7.2.19 (cli) (built: Jul 31 2019 17:32:32) ( NTS )
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.4.8
Built => Oct 21 2019 16:43:48
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
http2 => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
laravel version: 5.8.35
swooletw/laravel-swoole v2.6.66
CentOS 7
any workarounds for this?
Unable to reproduce here as well
Most helpful comment
@HenkPoley to be sure, Laravel it does:
@JamesKid can you reproduce your issue with these steps?
config/swoole_http.php, 'worker_num')