weixin_39874269
weixin_39874269
2021-01-08 14:03

Horizon calling classes that no longer exist

I'm having an issue where horizon is using old code/classes even after restarting horizon.

I'm using Forge/Envoyer.

In Forge I have a daemon running 'artisan horizon' And in Envoyer I call 'artisan horizon:terminate' during "Activate Release"

I've checked, the process is getting restarted, the work time and process ID reset after a deployment. There are no orphan workers or other queues running.

The error I'm getting is lluminate\Mail\SendQueuedMailable::handle(): The script tried to execute a method or access a property of an incomplete object. Which makes sense, because the class it's trying to load doesn't exist anymore.

So something it being cached somewhere and I'm not sure how to clear it.

This only happens on the production server, the local VM doesn't have this problem.

The only way I've found to fix this is to restart the production server, obviously that isn't ideal.

Anyone have this issue before? Any suggestions?

该提问来源于开源项目:laravel/horizon

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39759060 weixin_39759060 4月前

    do you have opcached enabled? Maybe you need to restart php-fpm after you deploy the code

    点赞 评论 复制链接分享
  • weixin_39828956 weixin_39828956 4月前

    do you run it after the active release hook? It's best to also run horizon:purge before terminating Horizon so you purge any orphan processes.

    https://medium.com//laravel-horizon-with-forge-and-envoyer-82a7e819d69f

    点赞 评论 复制链接分享
  • weixin_39874269 weixin_39874269 4月前

    I run horizon:terminate after 'active release' and horizon:purge after 'purge old releases'

    This problem has stopped happening on the production server for a while now, but I'm always on the look out for it when I push new code 😟

    I guess I should close this issue since it's not happening anymore, if I see it again I'll add the new information I find.

    点赞 评论 复制链接分享
  • weixin_39543773 weixin_39543773 4月前

    I've seen indications that sometimes in our production system, horizon:terminate does in fact not terminate anything.

    I'm using supervisor to manage horizon. I still need to investigate this. I haven't yet had this class error (but likely not many changes related to actual code used by the jobs).

    点赞 评论 复制链接分享

相关推荐