HDInnovations / UNIT3D-Community-Edition

Private Torrent Tracker Built With Laravel, Livewire and AlpineJS.
https://unit3d.dev
GNU Affero General Public License v3.0
1.91k stars 365 forks source link

[Bug] Serialization of 'Closure' is not allowed #3850

Open LostRager opened 1 month ago

LostRager commented 1 month ago

UNIT3D Version

8.1.3

PHP & Platform

8.3.7

Laravel verion

11.5.0

Have you done this?

Expectation

Serialization of 'Closure' is not allowed

Description

Serialization of 'Closure' is not allowed

Stack trace & logs

Serialization of 'Closure' is not allowed {"userId":3572,"exception":"[object] (Exception(code: 0): Serialization of 'Closure' is not allowed at /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:406)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(406): serialize()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(108): Illuminate\\Cache\\RedisStore->serialize()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(225): Illuminate\\Cache\\RedisStore->put()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(407): Illuminate\\Cache\\Repository->put()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(440): Illuminate\\Cache\\Repository->remember()
#5 /var/www/html/app/Http/Controllers/API/TorrentController.php(525): Illuminate\\Cache\\CacheManager->__call()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\\Http\\Controllers\\API\\TorrentController->filter()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(260): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(206): Illuminate\\Routing\\Route->runController()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#12 /var/www/html/app/Http/Middleware/CheckIfBanned.php(45): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\CheckIfBanned->handle()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php(65): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(127): Illuminate\\Routing\\Middleware\\ThrottleRequestsWithRedis->handleRequest()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(89): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequestUsingNamedLimiter()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(64): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Auth\\Middleware\\Authenticate->handle()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#27 /var/www/html/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#29 /var/www/html/app/Http/Middleware/BlockIpAddress.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\BlockIpAddress->handle()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle()
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#48 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1168): Illuminate\\Foundation\\Http\\Kernel->handle()
#49 /var/www/html/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest()
#50 {main}
"}

Upvote & Fund

Fund with Polar

Roardom commented 1 month ago

Do you know what http request triggered this? How frequently do you get this error?

LostRager commented 1 month ago

Do you know what http request triggered this? How frequently do you get this error?

I just noticed its the same userid everytime. Its every 10 minutes. I tried looking at the access logs, but i dont see anything jumping out at me.

Here is 1ms before, at and 1ms after the error is logged:


xx.xx.xx - - [22/May/2024:09:02:09 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&free[]=100&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 5944158 "-" "Prowlarr/1.15.0.4361 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:09 +0200] "GET /api/torrents/filter?name=i+feel+bad+S01&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 344 "-" "Prowlarr/1.17.1.4483 (ubuntu 24.04)"
xx.xx.xx - - [22/May/2024:09:02:09 +0200] "GET /api/torrents/filter?name=Skee+Mask+-+ISS007+-+2022&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 344 "-" "Prowlarr/1.17.2.4511 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:09 +0200] "GET /api/torrents/filter?categories[]=3&categories[]=10&name=Kendrick+Lamar+She+Needs+Me+remix+ringtone&free[]=100&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 344 "-" "Prowlarr/1.17.2.4511 (windows 10.0.22631.0)"
xx.xx.xx - - [22/May/2024:09:02:09 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1473013 "-" "Prowlarr/1.11.4.4173 (alpine 3.18.5)"
xx.xx.xx - - [22/May/2024:09:02:09 +0200] "GET /api/torrents/filter?name=Star+Wars+-+The+Clone+Wars+2008+S03E05&seasonNumber=3&episodeNumber=5&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 344 "-" "Prowlarr/1.18.0.4513 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&name=S02&seasonNumber=2&tvdbId=309523&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 344 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1472895 "-" "Prowlarr/1.17.2.4511 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1471700 "-" "Prowlarr/1.17.2.4511 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?name=Power+Rangers+S17&seasonNumber=17&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 344 "-" "Prowlarr/1.17.2.4511 (arch 1.0)"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?sortField=seeders&sortDirection=desc&perPage=100 HTTP/1.1" 500 1650 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?name=The+Last+Samurai+2003&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 65096 "-" "Prowlarr/1.16.2.4435 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&name=SpongeBob+Schwammkopf+S13E23&seasonNumber=13&episodeNumber=23&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 344 "-" "Prowlarr/1.17.1.4483 (ubuntu 24.04)"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1576531 "-" "Prowlarr/1.17.2.4511 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?categories[]=3&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1696104 "-" "Prowlarr/1.17.2.4511 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:11 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1471739 "-" "Prowlarr/1.17.2.4511 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:11 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1471753 "-" "Prowlarr/1.16.2.4435 (alpine 3.19.1)"
xx.xx.xx - - [22/May/2024:09:02:11 +0200] "GET /api/torrents/filter?categories[]=2&categories[]=6&sortField=created_at&sortDirection=desc&perPage=100 HTTP/1.1" 200 1471739 "-" "Prowlarr/1.17.2.4511 (alpine 3.19.1)"```
LostRager commented 1 month ago

I assume its this one since its error 500: xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?sortField=seeders&sortDirection=desc&perPage=100 HTTP/1.1" 500 1650 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"

LostRager commented 1 month ago

I assume its this one since its error 500: xx.xx.xx - - [22/May/2024:09:02:10 +0200] "GET /api/torrents/filter?sortField=seeders&sortDirection=desc&perPage=100 HTTP/1.1" 500 1650 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"

Yup, tested it with prowlarr. It does not like beeing sorted by seeders or size; title and created_at works fine.

Roardom commented 1 month ago

Amazing, thanks. Is one of the torrents with the most seeds lacking a type?

Roardom commented 1 month ago

I should clarify that I can't easily reproduce this. My best guess is that one of the torrents in the results is throwing errors inside here: https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/master/app/Http/Resources/TorrentResource.php and it's trying to cache the closure generated by the error.

LostRager commented 1 month ago

Amazing, thanks. Is one of the torrents with the most seeds lacking a type?

There are game_meta and no_meta torrents in the top seeded. Maybe its something related to resolution/poster/genres? Usually where the issues are.

For the size sorting, there are 3 no_meta torrents and 1 game.

LostRager commented 1 month ago

Tested it, seems like there is an issue with games. postponed the no_meta torrents and it still got the error. Postponed the game torrent and the issue went away.

My guess is genres since games uses array for genres. Tested this by setting genres to empty string, no change.

HDVinnie commented 1 month ago

Tested it, seems like there is an issue with games. postponed the no_meta torrents and it still got the error. Postponed the game torrent and the issue went away.

~My guess is genres since games uses array for genres.~ Tested this by setting genres to empty string, no change.

Hmm my guess is https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/68ef67e0fd44e430c1130ef7520c4a7479c0ba53/app/Http/Resources/TorrentResource.php#L32 causing issues with games. I'll look into it. It doesnt account for games.

Roardom commented 3 weeks ago

@LostRager Any luck figuring out which array key in the json response is triggering the 500?

LostRager commented 3 weeks ago

@LostRager Any luck figuring out which array key in the json response is triggering the 500?

No, i have not figured it out since last time we talked. Its definitly something to do with games tho. I tried setting most of the torrentresources to '' but no change. I also tried to just remove the whole meta attribute, but no change.

Not quite sure how to test further.