Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

StatisticsUpdated job crashing #10

Closed
ohnotnow opened this issue Dec 5, 2018 · 13 comments
Closed

StatisticsUpdated job crashing #10

ohnotnow opened this issue Dec 5, 2018 · 13 comments

Comments

@ohnotnow
Copy link

ohnotnow commented Dec 5, 2018

I've gone through the install and things seem to be working great as a drop-in replacement for Pusher - thanks! This is way nicer to use than the node echo server! :-)

I do keep seing a failed job in the horizon queue runner though - and no stats are being gathered (but the notifications are coming through ok in the app). The queue runner is outputting :

[2018-12-05 09:15:50][199] Processing: BeyondCode\LaravelWebsockets\Statistics\Events\StatisticsUpdated

   Symfony\Component\Debug\Exception\FatalErrorException  : method_exists(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "BeyondCode\LaravelWebsockets\Statistics\Events\StatisticsUpdated" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition

  at /Users/ohffs/Documents/code/examdb/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php:43
    39|      * @return void
    40|      */
    41|     public function handle(Broadcaster $broadcaster)
    42|     {
  > 43|         $name = method_exists($this->event, 'broadcastAs')
    44|                 ? $this->event->broadcastAs() : get_class($this->event);
    45|
    46|         $broadcaster->broadcast(
    47|             Arr::wrap($this->event->broadcastOn()), $name,


   Whoops\Exception\ErrorException  : method_exists(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "BeyondCode\LaravelWebsockets\Statistics\Events\StatisticsUpdated" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition

  at /Users/ohffs/Documents/code/examdb/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php:43
    39|      * @return void
    40|      */
    41|     public function handle(Broadcaster $broadcaster)
    42|     {
  > 43|         $name = method_exists($this->event, 'broadcastAs')
    44|                 ? $this->event->broadcastAs() : get_class($this->event);
    45|
    46|         $broadcaster->broadcast(
    47|             Arr::wrap($this->event->broadcastOn()), $name,

PHP Fatal error:  method_exists(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "BeyondCode\LaravelWebsockets\Statistics\Events\StatisticsUpdated" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Users/ohffs/Documents/code/examdb/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php on line 43

I'm using redis as the queue driver. I've tried the usual dump-autoload etc, restarting everything - but it keeps happening. I had a look at the StatisticsUpdated class and nothing was leaping out at me as being the 'ah-ha!' problem - sorry :-/

@mpociot
Copy link
Member

mpociot commented Dec 5, 2018

Have you restarted the queue worker so that it knows about the new event?
That's the only thing that comes to mind right now :)

@ohnotnow
Copy link
Author

ohnotnow commented Dec 5, 2018

Yep - been stopping and starting it quite a bit to try and debug it myself :-) I'll keep poking at it - if I find the reason I'll post back here :-)

Thanks again for the package - it's very appreciated :-)

@pprins
Copy link

pprins commented Dec 5, 2018

I've exactly the same problem. The $this->event is a PHP_Incomplete_Class so probably it has something to do with a unserialization of some task?

__PHP_Incomplete_Class(BeyondCode\LaravelWebsockets\Statistics\Events\StatisticsUpdated) {#698 #webSocketsStatisticsEntry: Illuminate\Contracts\Database\ModelIdentifier {#699 +class: "BeyondCode\LaravelWebSockets\Statistics\Models\WebSocketsStatisticsEntry" +id: 32 +relations: [] +connection: "mysql" }
For now I emptied / commented out the contents of the statistics option in the websockets configuration.

I can still play with this wonderful package. Keep up the awesome work.

@jafar-albadarneh
Copy link

Facing the same problem here:

2018-12-05 21:24:54][39] Processing: BeyondCode\LaravelWebsockets\Statistics\Events\StatisticsUpdated
PHP Fatal error:  method_exists(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "BeyondCode\LaravelWebsockets\Statistics\Events\StatisticsUpdated" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /Users/jafar/test-app/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php on line 43

Tried to restart the queue worker, without luck.
Btw, thanks for the awesome package.

@campope
Copy link

campope commented Dec 5, 2018

Same issue, I've restarted redis, flushed it, stopped and restarted queue etc. None of those seemed to do anything.

@stayallive
Copy link
Contributor

stayallive commented Dec 6, 2018

Same here, maybe this Sentry event helps somehow: https://sentry.io/share/issue/ca6da1cdacaa4b179bd943dcb128cd44/

Edit; After a quick look I also not found the culprit, if useful, both locally and in production this fails and I'm using Horizon + Redis + PHP 7.1.

@irazasyed irazasyed mentioned this issue Dec 6, 2018
@irazasyed
Copy link
Contributor

The issue should be fixed with the PR #33.

I'm testing since last few hours and it seems to be fine now.

@mpociot
Copy link
Member

mpociot commented Dec 6, 2018

This is now fixed with 1.0.2

@mpociot mpociot closed this as completed Dec 6, 2018
@parker-codes
Copy link

I am having this same issue and I am on v1.0.4. I receive it when I run php artisan queue:work with the database as the queue connection.

@Slawe
Copy link

Slawe commented Feb 13, 2019

just delete that event from "jobs" table in database.

@jampack
Copy link

jampack commented Feb 16, 2019

Same issue queue worker crashing, everything was working fine but i installed laravel-websockets in a separate project and configured broadcast driver as 'pusher' and added the host and port in my existing project and now the queue worker is crashing.

The thing is i dont have this package installed on that project, its in a different instance then that but queue worker in old project crashing referencing to this package, the only common thing between both the projects is Redis i.e my old project and the new project which only has this package installed uses a common redis server. Shutting down the project with this package installed fixes the issue and queue doesnt crash any more.

@jampack
Copy link

jampack commented Feb 16, 2019

The app names are different on both the projects though so:
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
should not allow the cache clash.

@jampack
Copy link

jampack commented Feb 16, 2019

Separating the cache dbs solved it, add unique db in both the projects, the issue is not related to this project -> .env
REDIS_DB=2
REDIS_CACHE_DB=2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants