Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stops working after a week #1065

Closed
ReVoLt112 opened this issue Jan 21, 2024 · 79 comments
Closed

Stops working after a week #1065

ReVoLt112 opened this issue Jan 21, 2024 · 79 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@ReVoLt112
Copy link

Hi, after one week my speedtest-tracker stops working. Sometimes it just doesnt execute scheduled tests, sometimes i get a HTTP500. Has someone also noticed same behaviour?

Unfortunately no helpful logs are produced... I am watching 3 instances and all 3 crash nearly same moment from saturday to sunday

@michaelmittermair
Copy link

Yep, same on my side. It seems, that the scheduled task is still runnning, but I also get an HTTP 500 on the frontend.

@nwagenmakers
Copy link

nwagenmakers commented Jan 21, 2024

Same here, only started the container yesterday (sat) around 15.00 (UTC+1), last run was at 23.00 (UTC+1), this morning I also saw the error 500.

Something happening on sat/sun night?

@michaelmittermair can you also confirm similar behavior?

@michaelmittermair
Copy link

Yes, look similar. I checked my container. It was running longer than just 1 day, but the last run was yesterday (SAT) 23:47pm (UTC +1).

@bive242
Copy link

bive242 commented Jan 21, 2024

Same here, no logs that give any useful information. Last successful run was (SAT) 23:42 (UTC+1). Next run would have been at (SUN) 00:12 (UTC+1).
So it appears that something happened around midnight.

@TempuzFugit
Copy link

Same here

@te5s3rakt
Copy link

same here. logs don't indicate anything has gone wrong. simply after about a week, server crashes, and web ui only loads showing 500 | SERVER ERROR

@nwagenmakers
Copy link

@te5s3rakt could you do one additional check (as I believe this could narrow down the probleem a bit). Could you check if this happens after midnight on Saturdays?

@te5s3rakt
Copy link

@te5s3rakt could you do one additional check (as I believe this could narrow down the probleem a bit). Could you check if this happens after midnight on Saturdays?

sure thing. my local time?

@nwagenmakers
Copy link

Yes, what UTC offset are you in?

@te5s3rakt
Copy link

Yes, what UTC offset are you in?

UTC + 8

I've just restarted and updated my container. I'll check next weekend how the container is going.

@mattjgalloway
Copy link

I had this too this morning. A restart of my docker container restored access for me.

I noticed in the logs that Laravel was throwing an error saying that no application encryption key has been specified.

@coro1404
Copy link

same here

@ThomasHFWright
Copy link

I had this too this morning. A restart of my docker container restored access for me.

I noticed in the logs that Laravel was throwing an error saying that no application encryption key has been specified.

I'm seeing this same error in the logs
[2024-01-23 16:30:35] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\Encryption\MissingAppKeyException(code: 0): No application encryption key has been specified. at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:79)

@alexjustesen
Copy link
Owner

For the app key error: https://docs.speedtest-tracker.dev/faqs#i-get-a-warning-on-container-start-up-that-the-app_key-is-missing

@ReVoLt112
Copy link
Author

ReVoLt112 commented Jan 24, 2024 via email

@Leave-MeAlone
Copy link

I have also a 500 on one of my instances, got the following error:

192.168.176.23 - - [24/Jan/2024:11:17:44 +0100] "GET /api/speedtest/latest HTTP/1.1" 200 386 "-" "-"
192.168.176.23 - - [24/Jan/2024:11:17:45 +0100] "GET /api/speedtest/latest HTTP/1.1" 200 386 "-" "-"
[2024-01-24 10:17:58] production.ERROR: Unsupported cipher or incorrect key length. Supported ciphers are: aes-128-cbc, aes-256-cbc, aes-128-gcm, aes-256-gcm. {"exception":"[object] (RuntimeException(code: 0): Unsupported cipher or incorrect key length. Supported ciphers are: aes-128-cbc, aes-256-cbc, aes-128-gcm, aes-256-gcm. at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:55)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(32): Illuminate\Encryption\Encrypter->__construct()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\Container\Container->build()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\Container\Container->resolve()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\Foundation\Application->resolve()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\Container\Container->make()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1066): Illuminate\Foundation\Application->make()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(982): Illuminate\Container\Container->resolveClass()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(943): Illuminate\Container\Container->resolveDependencies()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\Container\Container->build()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\Container\Container->resolve()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\Foundation\Application->resolve()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\Container\Container->make()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(172): Illuminate\Foundation\Application->make()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\Pipeline\Pipeline->then()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\Routing\Router->runRouteWithinStack()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\Routing\Router->runRoute()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\Routing\Router->dispatchToRoute()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#21 /var/www/html/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\Features\SupportDisablingBackButtonCache\DisableBackButtonCacheMiddleware->handle()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Http\Middleware\HandleCors->handle()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Http\Middleware\TrustProxies->handle()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#40 /var/www/html/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle()
#41 {main}
"}

@mmomjian
Copy link

My instance (Docker, using Postgres) just stopped responding at 00:00 EST (05:00 GMT) on Sunday morning. The same thing happened last Sunday. Logs seem to indicate some kind of issue connecting to Postgres. However, the Postgres server is running fine and connected to other apps. A restart of the Docker container fixes the issue.

The logs show the following:

[2024-01-28 05:00:42] production.ERROR: SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `results` order by `created_at` desc limit 1) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `results` order by `created_at` desc limit 1) at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:822)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(976): Illuminate\\Database\\Connection->runQueryCallback()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(955): Illuminate\\Database\\Connection->tryAgainIfCausedByLostConnection()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(778): Illuminate\\Database\\Connection->handleQueryException()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(407): Illuminate\\Database\\Connection->run()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2751): Illuminate\\Database\\Connection->select()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2740): Illuminate\\Database\\Query\\Builder->runSelect()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3294): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2739): Illuminate\\Database\\Query\\Builder->onceWithColumns()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(737): Illuminate\\Database\\Query\\Builder->get()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(721): Illuminate\\Database\\Eloquent\\Builder->getModels()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(333): Illuminate\\Database\\Eloquent\\Builder->get()
#11 /var/www/html/app/Http/Controllers/API/Speedtest/GetLatestController.php(18): Illuminate\\Database\\Eloquent\\Builder->first()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\\Http\\Controllers\\API\\Speedtest\\GetLatestController->__invoke()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(159): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(125): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequest()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(87): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequestUsingNamedLimiter()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#31 /var/www/html/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()

@te5s3rakt
Copy link

Yes, what UTC offset are you in?

UTC + 8

I've just restarted and updated my container. I'll check next weekend how the container is going.

Was right on time. Sunday morning container sh!t itself.

@Exit24
Copy link

Exit24 commented Jan 28, 2024

I get the same error after midnight Sunday, 500 | SERVER ERROR

@mattjgalloway
Copy link

Same again for me this Sunday. Error once again this one (when browsing to the server):

production.ERROR: No application encryption key has been specified

@ShlomiD83
Copy link

ShlomiD83 commented Jan 28, 2024

same problem here, running on RPi 4 with Postgres DB.
I can see these two error messages if that helps.

2024-01-28T07:58:15.918491042Z [previous exception] [object] (PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:65)

2024-01-28T07:58:22.570684825Z [2024-01-28 07:58:22] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\Encryption\MissingAppKeyException(code: 0): No application encryption key has been specified. at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:79)

I have an app key specified, if I recreate the container it will work for a few days.

restarting the container produces this error:
2024-01-28T08:02:58.099306835Z SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: delete f
2024-01-28T08:02:58.099321409Z rom cache)
2024-01-28T08:02:58.099335575Z
2024-01-28T08:02:58.099385074Z
2024-01-28T08:02:58.099653069Z In Connector.php line 65:
2024-01-28T08:02:58.099683272Z
2024-01-28T08:02:58.099833751Z SQLSTATE[HY000] [2002] Connection refused
2024-01-28T08:02:58.099928101Z
2024-01-28T08:02:58.099948231Z
2024-01-28T08:02:58.131371371Z s6-rc: warning: unable to start service laravel-automations: command exited 1
2024-01-28T08:02:58.136766293Z /run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
2024-01-28T08:02:58.136880161Z prog: fatal: stopping the container.

@ShlomiD83
Copy link

I get the same error after midnight Sunday, 500 | SERVER ERROR

I think mine also stops working every Sunday.

@michaelmittermair
Copy link

Same here.

My logs:

[2024-01-28 08:21:08] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\\Encryption\\MissingAppKeyException(code: 0): No application encryption key has been specified. at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:79) [stacktrace] #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php(307): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}() #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(77): tap() #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(60): Illuminate\\Encryption\\EncryptionServiceProvider->key() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(32): Illuminate\\Encryption\\EncryptionServiceProvider->parseKey() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build() #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve() #7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve() #8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make() #9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1066): Illuminate\\Foundation\\Application->make() #10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(982): Illuminate\\Container\\Container->resolveClass() #11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(943): Illuminate\\Container\\Container->resolveDependencies() #12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build() #13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve() #14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve() #15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make() #16 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(172): Illuminate\\Foundation\\Application->make() #17 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #18 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then() #19 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack() #20 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute() #21 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute() #22 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch() #23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}() #24 /var/www/html/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #25 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle() #26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #27 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle() #28 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle() #29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #30 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle() #31 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle() #32 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #33 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle() #34 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #35 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle() #36 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #37 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle() #38 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #39 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle() #40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}() #41 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then() #42 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter() #43 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle() #44 {main} "} 192.168.25.7 - - [28/Jan/2024:08:21:08 +0000] "GET / HTTP/1.1" 500 6628 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 OPR/106.0.0.0" [2024-01-28 08:21:08] production.ERROR: No application encryption key has been specified. {"exception":"[object] (Illuminate\\Encryption\\MissingAppKeyException(code: 0): No application encryption key has been specified. at /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:79) [stacktrace] #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php(307): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}() #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(77): tap() #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(60): Illuminate\\Encryption\\EncryptionServiceProvider->key() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(32): Illuminate\\Encryption\\EncryptionServiceProvider->parseKey() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build() #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve() #7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve() #8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make() #9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1066): Illuminate\\Foundation\\Application->make() #10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(982): Illuminate\\Container\\Container->resolveClass() #11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(943): Illuminate\\Container\\Container->resolveDependencies() #12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build() #13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve() #14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve() #15 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make() #16 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(255): Illuminate\\Foundation\\Application->make() #17 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(213): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware() #18 /var/www/html/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->terminate() #19 {main} "}

@crispybegs
Copy link

yep i get this sunday morning problem. restarting the speedtest and db containers gets it running again.

@te5s3rakt
Copy link

yep i get this sunday morning problem. restarting the speedtest and db containers gets it running again.

I only restart my speedtest container. my db one never presents any issues with anything else I have connected to it.

@coro1404
Copy link

same here (stopps with Error 500) Database is mariadb - restarting web container fixes the issue

@crispybegs
Copy link

yep i get this sunday morning problem. restarting the speedtest and db containers gets it running again.

I only restart my speedtest container. my db one never presents any issues with anything else I have connected to it.

i first tried restarting the speedtest container, but no joy. when i restarted both it worked again.

@Johnster001
Copy link

same here (stopps with Error 500) Database is mariadb - restarting web container fixes the issue

Same here. First week with this running, discovered it stopped last night. Restart of the Speedtest container fixed it.

@mmomjian
Copy link

mmomjian commented Jan 28, 2024

As a temporary workaround, you can add the following to your /etc/crontab on the docker host system to restart the container every sunday morning at 00:02 local time:

2 0 * * 0 root docker restart speedtest-tracker >/dev/null 2>&1

@mmomjian
Copy link

mmomjian commented Jan 28, 2024

i dont think that the app key is the reason for the server crash. I have a key generated and dont have a warning on start. My guess is that there is something wrong in: /app/Console/Kernel.php /** * Perform system maintenance weekly on Sunday morning, * start off the week nice and fresh. */ $schedule->command(SystemMaintenance::class)->weeklyOn(0) ->timezone($settings->timezone ?? 'UTC');

I agree this is probably the source of the issue. SystemMaintenance is sourced from app/console/commands/SystemMaintenance.php. I suspect the issue must be in this function:

    /**
     * Clear and refresh the cache.
     */
    protected function refreshCache(): void
    {
        Artisan::call('optimize:clear');

        Artisan::call('optimize');
    }

I can confirm that I can replicate the crash at a specific time by editing /app/console/Kernel.php and then restarting the container:

$schedule->command(SystemMaintenance::class)->weeklyOn(0,'12:12')

This causes a crash at 12:12 local time.

If I comment out both calls to Artisan in refreshCache () (SystemMaintenance.php), the server stays up even through a scheduled maintenance. Leaving either one uncommented will still result in a crash. My guess is that the optimize command somehow clears out the app key, even for people who have specified one, leading to a crash.

@darktweek
Copy link

+1 me too...

@p-jones
Copy link

p-jones commented Feb 4, 2024

I still have the problem. Stopped exactly at midnight. Front end worked. Just no tests run.

@crispybegs
Copy link

crispybegs commented Feb 4, 2024

oh, i just noticed, although neither of my instances stopped working, the scheduled behaviour changed after midnight.

One of my instances is scheduled to run 4 tests each day: at 2:01AM, 3:01AM, 4:01AM and 5:01AM
The other is also scheduled to run 4 tests each day: at 2:10AM, 3:10AM, 4:10AM and 5:10AM

As you can see here, this was happening fine all week, but then today (sunday) the first instance only ran one test at 5:01:20AM

Screenshot 2024-02-04 at 13 08 10

And the second instance ran at the correct times, but only ran two tests instead of the scheduled four..

Screenshot 2024-02-04 at 13 08 21

@dominikborkowski
Copy link

Another 'me too', stopped working at midnight. Using mariadb 10.

@alexjustesen
Copy link
Owner

#1097 and v0.14.7 incoming which wraps the weekly system maintenance command in try block so it soft fails.

Let's see if this helps 🤞

@mmomjian
Copy link

mmomjian commented Feb 4, 2024

Don't think this helped, unfortunately. Like before I added $schedule->command(SystemMaintenance::class)->weeklyOn(0,'14:09') in app/Console/Kernel.php to simulate a weekly run and it fails just like before with the debug trace in the docker logs. Running php artisan about before restarting the container gives:

In Connection.php line 829:

  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `cache` where `key` = laravel_cache_speedtest-remote-version limit 1)


In Connector.php line 65:

  SQLSTATE[HY000] [2002] Connection refused

I don't think the try/catch is the issue here, I think something about the Artisan cache clear is destroying some cached data that the app expects to still have.

@alexjustesen
Copy link
Owner

@mmomjian from your about output above your cache driver is set to file. Set it to database, restart the container and run php artisan db:show to confirm the tables.

@mmomjian
Copy link

mmomjian commented Feb 4, 2024

@alexjustesen here is some info to help. I had already changed the CACHE_DRIVER from earlier.

Fair warning this is a super long comment, my apologies.

docker-compose.yaml

            CACHE_DRIVER: 'database'
        image: 'ghcr.io/alexjustesen/speedtest-tracker:v0.14.7'

Run a a fresh docker compose down and up

# php artisan db:show

  Postgres .........................................................................................................................................
  Database ........................................................................................................................ speedtesttracker
  Host ............................................................................................................... redacted
  Port ........................................................................................................................................ redacted
  Username ........................................................................................................................ speedtesttracker
  URL ..............................................................................................................................................
  Open Connections .............................................................................................................................. 37
  Tables ........................................................................................................................................ 12
  Total Size ............................................................................................................................... 1.03MiB

  Table ................................................................................................................................. Size (MiB)
  migrations .................................................................................................................................. 0.02
  notifications ............................................................................................................................... 0.05
  results ..................................................................................................................................... 0.25
  cache ....................................................................................................................................... 0.11
  users ....................................................................................................................................... 0.05
  settings .................................................................................................................................... 0.05
  password_reset_tokens ....................................................................................................................... 0.02
  cache_locks ................................................................................................................................. 0.02
  jobs ........................................................................................................................................ 0.09
  personal_access_tokens ...................................................................................................................... 0.03
  sessions .................................................................................................................................... 0.33
  failed_jobs ................................................................................................................................. 0.02
# php artisan about

  Environment ......................................................................................................................................
  Application Name ............................................................................................................... Speedtest Tracker
  Laravel Version .......................................................................................................................... 10.43.0
  PHP Version ............................................................................................................................... 8.2.15
  Composer Version ........................................................................................................................... 2.6.6
  Environment ........................................................................................................................... production
  Debug Mode ................................................................................................................................... OFF
  URL .................................................................................................................................... localhost
  Maintenance Mode ............................................................................................................................. OFF

  Cache ............................................................................................................................................
  Config .................................................................................................................................... CACHED
  Events ................................................................................................................................ NOT CACHED
  Routes .................................................................................................................................... CACHED
  Views ................................................................................................................................. NOT CACHED

  Drivers ..........................................................................................................................................
  Broadcasting ................................................................................................................................. log
  Cache ................................................................................................................................... database
  Database ................................................................................................................................... pgsql
  Logs ...................................................................................................................................... stderr
  Mail ........................................................................................................................................ smtp
  Queue ................................................................................................................................... database
  Session ................................................................................................................................. database

  Filament .........................................................................................................................................
  Packages ......................................................................................... filament, forms, notifications, support, tables
  Version .................................................................................................................................. v3.2.23
  Views .............................................................................................................................. NOT PUBLISHED

  Livewire .........................................................................................................................................
  Livewire .................................................................................................................................. v3.4.4

  Speedtest Tracker ................................................................................................................................
  Out of date ................................................................................................................................... No
  Version .................................................................................................................................. v0.14.7

The website works fine.
I login to postgres:

speedtesttracker=# select * from cache;
                         key                          |     value     | expiration
------------------------------------------------------+---------------+------------
 laravel_cache_speedtest-remote-version               | s:8:"v0.14.7 +| 1707160434
                                                      | ";            |
 laravel_cache_b9cf9c68906d10caefd1ea7b5136c281:timer | i:1707074189; | 1707074189
 laravel_cache_b9cf9c68906d10caefd1ea7b5136c281       | i:1;          | 1707074189
(3 rows)

I edit app/Console/Kernel.php to change the time of SystemMaintenance to 14:22 local time. At that time, the website returns a 500 error. Docker logs show:

[2024-02-04 19:22:11] production.ERROR: SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `sessions` where `id` = WT19HvuZ137oyMU6ykIPiQuIn3FJHkHJPrAsZR85 lim
it 1) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `sessions` where `id` = WT19
HvuZ137oyMU6ykIPiQuIn3FJHkHJPrAsZR85 limit 1) at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(983): Illuminate\\Database\\Connection->runQueryCallback()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(962): Illuminate\\Database\\Connection->tryAgainIfCausedByLostConnection()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(785): Illuminate\\Database\\Connection->handleQueryException()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\\Database\\Connection->run()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2751): Illuminate\\Database\\Connection->select()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2740): Illuminate\\Database\\Query\\Builder->runSelect()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3294): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2739): Illuminate\\Database\\Query\\Builder->onceWithColumns()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(333): Illuminate\\Database\\Query\\Builder->get()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2662): Illuminate\\Database\\Query\\Builder->first()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/DatabaseSessionHandler.php(97): Illuminate\\Database\\Query\\Builder->find()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Store.php(113): Illuminate\\Session\\DatabaseSessionHandler->read()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Store.php(101): Illuminate\\Session\\Store->readFromHandler()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Store.php(85): Illuminate\\Session\\Store->loadSession()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(147): Illuminate\\Session\\Store->start()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php(307): Illuminate\\Session\\Middleware\\StartSession->Illuminate\\Session\\Middleware\\{closure}()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(144): tap()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(116): Illuminate\\Session\\Middleware\\StartSession->startSession()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\StartSession->handle()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#31 /var/www/html/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
php artisan about
[2024-02-04 19:23:31] production.ERROR: SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `cache` where `key` = laravel_cache_speedtest-remote-version limit 1
) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `cache` where `key` = laravel_ca
che_speedtest-remote-version limit 1) at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(983): Illuminate\\Database\\Connection->runQueryCallback()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(962): Illuminate\\Database\\Connection->tryAgainIfCausedByLostConnection()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(785): Illuminate\\Database\\Connection->handleQueryException()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(414): Illuminate\\Database\\Connection->run()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2751): Illuminate\\Database\\Connection->select()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2740): Illuminate\\Database\\Query\\Builder->runSelect()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3294): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2739): Illuminate\\Database\\Query\\Builder->onceWithColumns()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(333): Illuminate\\Database\\Query\\Builder->get()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/DatabaseStore.php(103): Illuminate\\Database\\Query\\Builder->first()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(99): Illuminate\\Cache\\DatabaseStore->get()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(388): Illuminate\\Cache\\Repository->get()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(429): Illuminate\\Cache\\Repository->remember()
#13 /var/www/html/app/Services/SystemChecker.php(34): Illuminate\\Cache\\CacheManager->__call()
#14 /var/www/html/app/Services/SystemChecker.php(22): App\\Services\\SystemChecker->getRemoteVersion()
#15 /var/www/html/app/Services/SystemChecker.php(41): App\\Services\\SystemChecker->getVersions()
#16 /var/www/html/app/Providers/AppServiceProvider.php(38): App\\Services\\SystemChecker->isOutOfDate()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Providers\\AppServiceProvider->App\\Providers\\{closure}()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(81): Illuminate\\Container\\Util::unwrapIfClosure()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/AboutCommand.php(83): Illuminate\\Container\\Container->call()
#23 [internal function]: Illuminate\\Foundation\\Console\\AboutCommand->Illuminate\\Foundation\\Console\\{closure}()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(558): array_map()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\\Support\\Arr::map()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/AboutCommand.php(74): Illuminate\\Support\\Collection->map()
#27 [internal function]: Illuminate\\Foundation\\Console\\AboutCommand->Illuminate\\Foundation\\Console\\{closure}()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(558): array_map()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\\Support\\Arr::map()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/AboutCommand.php(73): Illuminate\\Support\\Collection->map()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Foundation\\Console\\AboutCommand->handle()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#37 /var/www/html/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#39 /var/www/html/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#40 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#41 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#43 /var/www/html/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#44 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#48 /var/www/html/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#49 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#50 /var/www/html/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#51 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#52 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#53 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#54 /var/www/html/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#55 {main}
"}

In Connection.php line 829:

  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `cache` where `key` = laravel_cache_speedtest-remote-version limit 1)


In Connector.php line 65:

  SQLSTATE[HY000] [2002] Connection refused

speedtesttracker=# select * from cache;
 key | value | expiration
-----+-------+------------
(0 rows)
# php artisan db:show
[2024-02-04 19:24:08] production.ERROR: SQLSTATE[HY000] [2002] Connection refused {"exception":"[object] (PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:65)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(65): PDO->__construct()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(83): Illuminate\\Database\\Connectors\\Connector->createPdoConnection()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(48): Illuminate\\Database\\Connectors\\Connector->tryAgainIfCausedByLostConnection()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\\Database\\Connectors\\MySqlConnector->connect()
#5 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1339): call_user_func()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1288): Illuminate\\Database\\Connection->getPdo()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/ShowCommand.php(47): Illuminate\\Database\\Connection->getDoctrineConnection()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Database\\Console\\ShowCommand->handle()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#15 /var/www/html/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#17 /var/www/html/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#18 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#19 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#21 /var/www/html/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#22 {main}
"}

In Connector.php line 65:

  SQLSTATE[HY000] [2002] Connection refused


@alexjustesen
Copy link
Owner

@mmomjian can you share your .env file and docker-compose.yml file? My guess is you're missing an env variable because it's trying to connect to a mysql db instead of pgsql

@mmomjian
Copy link

mmomjian commented Feb 4, 2024

Docker compose is below. The env file is just the postgres connection parameters.

  speedtest-tracker:
        <<: [ *throttle-micro, *nonew, *rsus ]
        container_name: speedtest-tracker
        hostname: speedtest-tracker
        ports:
            - '15781:443'
        networks:
            docknet_teal:
                ipv4_address: redacted
        environment:
            TZ: ${tz}
            PUID: '17683'
            PGID: '17683'
            DB_CONNECTION: 'pgsql'
            DB_HOST: ${pghost2}
            DB_PORT: ${pgport}
            DB_DATABASE: ${pgspeeddb}
            DB_USERNAME: ${pgspeeduser}
            DB_PASSWORD: ${pgspeedpw}
            FORCE_HTTPS: 'true'
            CACHE_DRIVER: 'database'
        labels:
          homepage.name: Speedtest Tracker
          homepage.group: Network
          homepage.href: redacted
          homepage.icon: mdi-speedometer
          homepage.widget.type: speedtest
          homepage.widget.url: redacted
        healthcheck:
         test: curl --insecure -fsS https://127.0.0.1 | grep -c 'title>Dashboard - Speedtest Tracker</title' || exit 1
         <<: *healthdefault
        volumes:
            - '${dockerdata}/speedtest-tracker:/config'
            - '${redacted}/fullchain.pem:/etc/ssl/web/ssl.crt:ro'
            - '${redacted}/privkey.pem:/etc/ssl/web/ssl.key:ro'
        image: 'ghcr.io/alexjustesen/speedtest-tracker:v0.14.7'

Here is the .env file from within the container:

# more .env
# A full list of options can be found in the '.env.example' file.

# Application key
# Used for encryption where needed, if a key is not generated run: php artisan key:generate
APP_KEY=base64:<redacted>

# Application URL
# Not used in the URL but effects links in emails and notifications: https://docs.speedtest-tracker.dev/faqs#links-in-emails-dont-point-to-the-correct-url
APP_URL=http://localhost

# SMTP mail config
# Only SMTP protocol is supported at this time: https://docs.speedtest-tracker.dev/settings/notifications/mail
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="Speedtest Tracker"

# Telegram bot config
TELEGRAM_BOT_TOKEN=null

@alexjustesen
Copy link
Owner

Thanks I'll dig into this more later. In the meantime does your .env file have an APP_KEY?

@mmomjian
Copy link

mmomjian commented Feb 4, 2024

Just updated my comment. There is a 31 character app key in the container's /var/www/html/.env, in the format APP_KEY=base64:BzL.............ovk=

@alexjustesen
Copy link
Owner

@mmomjian that's normal, make sure you generate your key correctly.

@mmomjian
Copy link

mmomjian commented Feb 5, 2024

@alexjustesen I didn’t generate the key, that’s the automatically created one.

@alexjustesen
Copy link
Owner

@mmomjian is there a problem with the key? If so want to keep on topic to make sure I've addressed the scheduler stopping.

@ReVoLt112 is OP so if they say it's resolved or others can confirm I'd like to get this issue closed.

@mmomjian
Copy link

mmomjian commented Feb 7, 2024

@alexjustesen I'm not sure what you mean by a problem with the key? As my last checking, the web portal stops replying at 00:00 local time every Sunday morning. Anything beyond that is just our guesses at what the problem could be. You had asked me about the APP_KEY so that's why I posted that. At 00:00, that DATABASE_CACHE seems to be changed from database to file base on php artisan about.

@ReVoLt112
Copy link
Author

@mmomjian is there a problem with the key? If so want to keep on topic to make sure I've addressed the scheduler stopping.

@ReVoLt112 is OP so if they say it's resolved or others can confirm I'd like to get this issue closed.

i will report back on Sunday morning

@Churator
Copy link

Churator commented Feb 7, 2024

@mmomjian is there a problem with the key? If so want to keep on topic to make sure I've addressed the scheduler stopping.

@ReVoLt112 is OP so if they say it's resolved or others can confirm I'd like to get this issue closed.

is there a way to "force" it to maintenance mode so we can try before Sunday morning ?
php artisan optimize:clear and php artisan optimize didn't help

@mmomjian
Copy link

mmomjian commented Feb 7, 2024

@Churator @alexjustesen I have been simulating a maintenance by editing Kernel.php to change the time of the cron job to whenever I want (outlined above). I just did a test with v0.15.0 and the crash behavior (500 error, unable to connect to DB) is exactly the same as it was in the earlier version.

After the test, I always destroy the old container and start with a fresh install. We will see what happens on Sunday but I highly suspect it will be the same crash behavior.

@Starfiresg1
Copy link

Starfiresg1 commented Feb 7, 2024

I've extensively triggered the error over the last few days manually. The conclusion I arrived at is that as soon as the system maintenance runs all settings that are set by docker environment variables are no longer used.

Steps I took:
Initially I got the error about the missing app key as soon as the error happened in the log.
I checked the .env-file - no app key set there (only through docker environment). So I deleted the .env file and restarted the container. Same error as before when the maintenance runs. Checked the new .env-file - app key was still empty.
Then I started looking around the source - apparently the key is loaded either from environment or from the .env-file - but it is never put from the docker environment into the .env-file automatically.
So I manually put the same app key from docker environment in the .env-file and triggered system maintenance again.
I still got error 500 but this time the error log was different - it's now complaining about mysql refusing the connection.
I think it is trying to reach 127.0.0.1 which seems to be the default in source and not the one defined in the docker environment variables.
So I put my database-connection in the .env-file (all settings that are different from the default in the source code) and triggered system maintenance again and voila - the server seems to survive - no error 500 in the GUI and nothing in the docker log.

This leads me to the conclusion that with system maintenance running only the default settings from the source code and the settings from the .env-file come into play - docker environment variables are no longer used by the app (but still set - I checked with "set"-command).

Strange is that all this only happens when the maintenance commands are triggered by the source code. If I run php artisan optimize oder optimize:clear in the console the error never happens.

@mmomjian
Copy link

mmomjian commented Feb 7, 2024

@Starfiresg1 this is an excellent writeup and it tracks exactly with my observations.

I can't quite seem to figure out what about the source code is causing this, since the same commands run in the console do not cause it. Could it be that running it from the console persists the env vars through the Shell and this allows artisan to retain the otherwise-lost variables through an interactive shell?

@alexjustesen
Copy link
Owner

@Starfiresg1 this is excellent, thanks for digging into the issue.

I'm using optimize:clear which clears ALL cached data which includes any config and environment variables. #1114 is a hotfix building now that updates the process to only clear the cache and view cache so this will now skip clearing the config cache.

@alexjustesen
Copy link
Owner

Once v0.15.2 is rolled out @Starfiresg1 mind running your tests again to confirm the fix?

@Starfiresg1
Copy link

@alexjustesen of course, no problem

@Starfiresg1
Copy link

Pulled v0.15.2 and reset my .env to the default (no DB-settings, no APP_KEY) and run the system maintenance twice by modifying Kernel.php - the web GUI survived both times without displaying an error.
Seems to be fixed 👍

@mmomjian
Copy link

mmomjian commented Feb 7, 2024

Fixed on my end as well, using env vars, and the modified cron job time. Thanks @alexjustesen !

@alexjustesen
Copy link
Owner

Putting a pin in it then! Thanks all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests