HDInnovations / UNIT3D-Community-Edition

Private Torrent Tracker Built With Laravel, Livewire and AlpineJS.
GNU Affero General Public License v3.0
1.94k stars 370 forks source link

[Bug] Base table or view not found: 1146 Table 'unit3d.torrents' #4048

Closed josecelano closed 1 month ago

josecelano commented 1 month ago

UNIT3D Version

8.1.3

PHP & Platform

8.3.10 - Ubuntu 22.04

Laravel verion

11.5.0

Have you done this?

Expectation

I would expect the logs to be clean.

Description

I've just installed the application with a clean installation in a new server from scratch using the installer: https://github.com/HDInnovations/UNIT3D-Installer

OS: Linux PHP: 8.3.10 Database: 8.0.39-0ubuntu0.22.04.1 Laravel: 11.5.0 UNIT3D Community Edition: v8.1.3

The Laravel log contains this error:

image

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'unit3d.torrents' doesn't exist (Connection: mysql, SQL: update `torrents` left join (select `torrent_id`, SUM(peers.left = 0 AND peers.active = 1 AND peers.visible = 1) AS updated_seeders, SUM(peers.left != 0 AND peers.active = 1 AND peers.visible = 1) AS updated_leechers from `peers` group by `torrent_id`) as `seeders_leechers` on `torrents`.`id` = `seeders_leechers`.`torrent_id` set `seeders` = COALESCE(seeders_leechers.updated_seeders, 0), `leechers` = COALESCE(seeders_leechers.updated_leechers, 0), `torrents`.`updated_at` = updated_at)

Stack trace & logs

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'unit3d.torrents' doesn't exist (Connection: mysql, SQL: update `torrents` left join (select `torrent_id`, SUM(peers.left = 0 AND peers.active = 1 AND peers.visible = 1) AS updated_seeders, SUM(peers.left != 0 AND peers.active = 1 AND peers.visible = 1) AS updated_leechers from `peers` group by `torrent_id`) as `seeders_leechers` on `torrents`.`id` = `seeders_leechers`.`torrent_id` set `seeders` = COALESCE(seeders_leechers.updated_seeders, 0), `leechers` = COALESCE(seeders_leechers.updated_leechers, 0), `torrents`.`updated_at` = updated_at) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'unit3d.torrents' doesn't exist (Connection: mysql, SQL: update `torrents` left join (select `torrent_id`, SUM(peers.left = 0 AND peers.active = 1 AND peers.visible = 1) AS updated_seeders, SUM(peers.left != 0 AND peers.active = 1 AND peers.visible = 1) AS updated_leechers from `peers` group by `torrent_id`) as `seeders_leechers` on `torrents`.`id` = `seeders_leechers`.`torrent_id` set `seeders` = COALESCE(seeders_leechers.updated_seeders, 0), `leechers` = COALESCE(seeders_leechers.updated_leechers, 0), `torrents`.`updated_at` = updated_at) at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:813)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(767): Illuminate\\Database\\Connection->runQueryCallback()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(584): Illuminate\\Database\\Connection->run()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(536): Illuminate\\Database\\Connection->affectingStatement()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3663): Illuminate\\Database\\Connection->update()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1105): Illuminate\\Database\\Query\\Builder->update()
#5 /var/www/html/app/Console/Commands/SyncPeers.php(60): Illuminate\\Database\\Eloquent\\Builder->update()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(30): App\\Console\\Commands\\SyncPeers->App\\Console\\Commands\\{closure}()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(456): Illuminate\\Database\\Connection->transaction()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(357): Illuminate\\Database\\DatabaseManager->__call()
#9 /var/www/html/app/Console/Commands/SyncPeers.php(49): Illuminate\\Support\\Facades\\Facade::__callStatic()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\SyncPeers->handle()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\\Container\\Container->call()
#16 /var/www/html/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run()
#18 /var/www/html/vendor/symfony/console/Application.php(1049): Illuminate\\Console\\Command->run()
#19 /var/www/html/vendor/symfony/console/Application.php(318): Symfony\\Component\\Console\\Application->doRunCommand()
#20 /var/www/html/vendor/symfony/console/Application.php(169): Symfony\\Component\\Console\\Application->doRun()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\\Component\\Console\\Application->run()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1183): Illuminate\\Foundation\\Console\\Kernel->handle()
#23 /var/www/html/artisan(13): Illuminate\\Foundation\\Application->handleCommand()
#24 {main}

[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'unit3d.torrents' doesn't exist at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:592)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(592): PDO->prepare()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(800): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(767): Illuminate\\Database\\Connection->runQueryCallback()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(584): Illuminate\\Database\\Connection->run()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(536): Illuminate\\Database\\Connection->affectingStatement()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3663): Illuminate\\Database\\Connection->update()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1105): Illuminate\\Database\\Query\\Builder->update()
#7 /var/www/html/app/Console/Commands/SyncPeers.php(60): Illuminate\\Database\\Eloquent\\Builder->update()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(30): App\\Console\\Commands\\SyncPeers->App\\Console\\Commands\\{closure}()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(456): Illuminate\\Database\\Connection->transaction()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(357): Illuminate\\Database\\DatabaseManager->__call()
#11 /var/www/html/app/Console/Commands/SyncPeers.php(49): Illuminate\\Support\\Facades\\Facade::__callStatic()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\SyncPeers->handle()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\\Container\\Container->call()
#18 /var/www/html/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run()
#20 /var/www/html/vendor/symfony/console/Application.php(1049): Illuminate\\Console\\Command->run()
#21 /var/www/html/vendor/symfony/console/Application.php(318): Symfony\\Component\\Console\\Application->doRunCommand()
#22 /var/www/html/vendor/symfony/console/Application.php(169): Symfony\\Component\\Console\\Application->doRun()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\\Component\\Console\\Application->run()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1183): Illuminate\\Foundation\\Console\\Kernel->handle()
#25 /var/www/html/artisan(13): Illuminate\\Foundation\\Application->handleCommand()
#26 {main}
"}

Upvote & Fund

Fund with Polar

HDVinnie commented 1 month ago

@josecelano either there was a error or warning during installer or this was a race condition. I'm not able to replicate. However can you confirm the table is actually there in MySQL or simply by trying to view torrents page and trying to upload a torrent. If that all works then this error can be ignored and was simply a race condition during install.

josecelano commented 1 month ago

@josecelano either there was a error or warning during installer or this was a race condition. I'm not able to replicate. However can you confirm the table is actually there in MySQL or simply by trying to view torrents page and trying to upload a torrent. If that all works then this error can be ignored and was simply a race condition during install.

The table is there:

mysql> desc torrents;
+------------------+-------------------+------+-----+---------+----------------+
| Field            | Type              | Null | Key | Default | Extra          |
+------------------+-------------------+------+-----+---------+----------------+
| id               | int unsigned      | NO   | PRI | NULL    | auto_increment |
| name             | varchar(255)      | NO   | MUL | NULL    |                |
| description      | text              | NO   |     | NULL    |                |
| mediainfo        | text              | YES  |     | NULL    |                |
| bdinfo           | longtext          | YES  |     | NULL    |                |
| file_name        | varchar(255)      | NO   |     | NULL    |                |
| num_file         | int               | NO   |     | NULL    |                |
| folder           | varchar(255)      | YES  |     | NULL    |                |
| size             | double            | NO   |     | NULL    |                |
| nfo              | blob              | YES  |     | NULL    |                |
| leechers         | int               | NO   | MUL | 0       |                |
| seeders          | int               | NO   | MUL | 0       |                |
| times_completed  | int               | NO   |     | 0       |                |
| category_id      | int               | YES  | MUL | NULL    |                |
| user_id          | int unsigned      | NO   | MUL | NULL    |                |
| imdb             | int unsigned      | NO   | MUL | 0       |                |
| tvdb             | int unsigned      | NO   | MUL | 0       |                |
| tmdb             | int unsigned      | NO   | MUL | 0       |                |
| mal              | int unsigned      | NO   | MUL | 0       |                |
| igdb             | varchar(255)      | NO   | MUL | 0       |                |
| season_number    | int               | YES  | MUL | NULL    |                |
| episode_number   | int               | YES  | MUL | NULL    |                |
| stream           | tinyint(1)        | NO   |     | 0       |                |
| free             | smallint          | NO   |     | 0       |                |
| doubleup         | tinyint(1)        | NO   |     | 0       |                |
| refundable       | tinyint(1)        | NO   |     | 0       |                |
| highspeed        | tinyint(1)        | NO   |     | 0       |                |
| featured         | tinyint(1)        | NO   |     | 0       |                |
| status           | smallint          | NO   | MUL | 0       |                |
| moderated_at     | datetime          | YES  |     | NULL    |                |
| moderated_by     | int               | YES  | MUL | NULL    |                |
| anon             | smallint          | NO   |     | 0       |                |
| sticky           | smallint          | NO   | MUL | 0       |                |
| sd               | tinyint(1)        | NO   |     | 0       |                |
| internal         | tinyint(1)        | NO   |     | 0       |                |
| created_at       | timestamp         | YES  | MUL | NULL    |                |
| updated_at       | timestamp         | YES  |     | NULL    |                |
| bumped_at        | datetime          | YES  | MUL | NULL    |                |
| fl_until         | datetime          | YES  | MUL | NULL    |                |
| du_until         | datetime          | YES  |     | NULL    |                |
| release_year     | smallint unsigned | YES  | MUL | NULL    |                |
| type_id          | int               | NO   | MUL | NULL    |                |
| resolution_id    | int               | YES  | MUL | NULL    |                |
| distributor_id   | int               | YES  | MUL | NULL    |                |
| region_id        | int               | YES  | MUL | NULL    |                |
| personal_release | int               | NO   | MUL | 0       |                |
| balance          | bigint            | YES  |     | NULL    |                |
| balance_offset   | bigint            | YES  |     | NULL    |                |
| info_hash        | binary(20)        | NO   | MUL | NULL    |                |
+------------------+-------------------+------+-----+---------+----------------+
49 rows in set (0.00 sec)

And I was able to upload a torrent. If you want more logs, just let me know.