laravel / pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.
https://pulse.laravel.com
MIT License
1.36k stars 161 forks source link

500 Server Error displaying #365

Closed cAstraea closed 2 months ago

cAstraea commented 2 months ago

Pulse Version

beta13

Laravel Version

10.46.0

PHP Version

8.2.9

Livewire Version

3.4.6

Database Driver & Version

Amazon RDS

Description

[2024-05-08 12:22:05] production.ERROR: Syntax error {"exception":"[object] (JsonException(code: 4): Syntax error at /srv/www/****/vendor/laravel/pulse/src/Livewire/SlowQueries.php:40) [stacktrace]

0 /srv/www/****/vendor/laravel/pulse/src/Livewire/SlowQueries.php(40): json_decode()

1 [internal function]: Laravel\Pulse\Livewire\SlowQueries->Laravel\Pulse\Livewire\{closure}()

2 /srv/www/****/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(600): array_map()

3 /srv/www/****/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\Support\Arr::map()

4 /srv/www/****/vendor/laravel/pulse/src/Livewire/SlowQueries.php(39): Illuminate\Support\Collection->map()

5 /srv/www/****/vendor/laravel/pulse/src/Livewire/Concerns/RemembersQueries.php(25): Laravel\Pulse\Livewire\SlowQueries->Laravel\Pulse\Livewire\{closure}()

6 /srv/www/****/vendor/laravel/framework/src/Illuminate/Support/Benchmark.php(49): Laravel\Pulse\Livewire\Card->Laravel\Pulse\Livewire\Concerns\{closure}()

7 /srv/www/****/vendor/laravel/pulse/src/Livewire/Concerns/RemembersQueries.php(25): Illuminate\Support\Benchmark::value()

8 /srv/www/****/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(397): Laravel\Pulse\Livewire\Card->Laravel\Pulse\Livewire\Concerns\{closure}()

9 /srv/www/****/vendor/laravel/pulse/src/Livewire/Concerns/RemembersQueries.php(22): Illuminate\Cache\Repository->remember()

10 /srv/www/****/vendor/laravel/pulse/src/Livewire/SlowQueries.php(31): Laravel\Pulse\Livewire\Card->remember()

11 /srv/www/****/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Laravel\Pulse\Livewire\SlowQueries->render()

12 /srv/www/****/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()

13 /srv/www/****/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()

14 /srv/www/****/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()

15 /srv/www/****/vendor/livewire/livewire/src/Wrapped.php(23): Illuminate\Container\BoundMethod::call()

Steps To Reproduce

truncated the pulse_aggregates and pulse_entries tables since they got to a few millions rows in size in a few days. Now I see this error in the laravel log and the pulse dashboard not displaying. I tried disabling the SlowQueries card to no success.

timacdonald commented 2 months ago

Hey there,

This sounds like some of the data in your database is corrupt, specifically a JSON payload in the key column.

I would recommend:

  1. Disabling Pulse.
  2. Stopping the pulse:work command.
  3. Truncating all the pulse_* tables.
  4. Verifying that the tables are empty.
  5. Reactivating Pulse
  6. Starting the pulse:work command.

Unfortunately, this is a data problem rather than a code problem.

If you have a very heavy traffic load with Pulse active, we highly recommend you use the Redis ingest: https://laravel.com/docs/11.x/pulse#ingest