HDInnovations / UNIT3D-Community-Edition

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

[Help] 500 Internal server error #3984

Closed mibj2 closed 1 month ago

mibj2 commented 1 month ago

I should receive a series of torrents based on the type_id.

https://xxx.xxx/api/torrents/filter?api_token=[token]&types%5B%5D=1&perPage=150

It works only when perPage is equal to 50 or less; otherwise, the server returns a 500 internal server error

I don't know if it's a bug. Could it depend on the server's performance?

Upvote & Fund

Fund with Polar

Roardom commented 1 month ago

Every error 500 generates a stacktrace in your server logs for debugging. Please include this stacktrace, otherwise it's pointless to debug.

mibj2 commented 1 month ago

I checked error.log and error.log.1 in the nginx folder, but there is no trace of my IP. Where else can I check ?

Roardom commented 1 month ago

Check the staff dashboard -> Laravel Log

Or they can be found in [project root directory]/storage/logs.

mibj2 commented 1 month ago

he look like there are not new log but the old one

Roardom commented 1 month ago

Generating the error 500 again will create another new stacktrace that can be found in the log. Please send the stack trace here (with any sensitive data redacted).

mibj2 commented 1 month ago

Thank you, I'll retry later, I'm on the road at the moment. But I have a question: the parameter 'perPage' returns the amount of results per page (default: 25). How do I know how many items are available from the server so I can split the whole list by pages( i mean on terminal)? I can't select a virtual page either

Roardom commented 1 month ago

Thank you, I'll retry later, I'm on the road at the moment. But I have a question: the parameter 'perPage' returns the amount of results per page (default: 25). How do I know how many items are available from the server so I can split the whole list by pages( i mean on terminal)? I can't select a virtual page either

That's intentional. Calculating the hundreds of thousands of matching results was a large bottleneck in the (current) database search. The json response has a links key that provides the links to the next/previous pages. The links.next key is null if there is no next page (i.e. it's the last page). Doing it this way allows much more efficient pagination. The alternative is using something like #3061 but it will only return pagination up to the top 1000 matching results and won't return beyond that.

mibj2 commented 1 month ago

news : The links.next is a nice trick, and I was able to solve my problem without overloading the server

500 error log: ` ERROR Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

Allowed memory size of 134217728 bytes exhausted (tried to allocate 27267072 bytes) {"userId":1179,"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Allowed memory size of 134217728 bytes exhausted (tried to allocate 27267072 bytes) at /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:406) [stacktrace]

0 {main}

"}

`

Roardom commented 1 month ago

You will have to tune your server: https://www.php.net/manual/en/ini.core.php#ini.memory-limit

mibj2 commented 1 month ago

Thank you