Librum-Reader / Librum-Server

The Librum server
https://librumreader.com
GNU Affero General Public License v3.0
281 stars 21 forks source link

Database Error - Row size too large #33

Open 0x2142 opened 5 months ago

0x2142 commented 5 months ago

Hi there & Thanks for this project! I'm interested in giving it a try.

I'm trying to run a local instance using the provided docker-compose.yml. However, I'm getting the following errors on the first run:

2024-04-05T15:09:48.625553261Z Running in selfhosted mode, skipping AzureKeyVault and Stripe configuration
2024-04-05T15:09:49.281132613Z warn: Microsoft.EntityFrameworkCore.Model.Validation[10400]
2024-04-05T15:09:49.281162997Z       Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data; this mode should only be enabled during development.
2024-04-05T15:09:49.942683309Z fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
2024-04-05T15:09:49.942706366Z       Failed executing DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
2024-04-05T15:09:49.942710367Z       CREATE TABLE `Folders` (
2024-04-05T15:09:49.942714044Z           `FolderId` char(36) COLLATE ascii_general_ci NOT NULL,
2024-04-05T15:09:49.942717624Z           `Name` varchar(5000) CHARACTER SET utf8mb4 NOT NULL,
2024-04-05T15:09:49.942721206Z           `Color` varchar(500) CHARACTER SET utf8mb4 NOT NULL,
2024-04-05T15:09:49.942724695Z           `Icon` varchar(500) CHARACTER SET utf8mb4 NOT NULL,
2024-04-05T15:09:49.942728254Z           `Description` varchar(10000) CHARACTER SET utf8mb4 NOT NULL,
2024-04-05T15:09:49.942731785Z           `LastModified` varchar(500) CHARACTER SET utf8mb4 NOT NULL,
2024-04-05T15:09:49.942735308Z           `IndexInParent` int NOT NULL,
2024-04-05T15:09:49.942738824Z           `ParentFolderId` char(36) COLLATE ascii_general_ci NULL,
2024-04-05T15:09:49.942742403Z           CONSTRAINT `PK_Folders` PRIMARY KEY (`FolderId`),
2024-04-05T15:09:49.942746004Z           CONSTRAINT `FK_Folders_Folders_ParentFolderId` FOREIGN KEY (`ParentFolderId`) REFERENCES `Folders` (`FolderId`)
2024-04-05T15:09:49.942749701Z       ) CHARACTER SET=utf8mb4;
2024-04-05T15:09:49.957015767Z Unhandled exception. MySqlConnector.MySqlException (0x80004005): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
2024-04-05T15:09:49.957036052Z    at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 44
2024-04-05T15:09:49.957040201Z    at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 127
2024-04-05T15:09:49.957044053Z    at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 456
2024-04-05T15:09:49.957048001Z    at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 56
2024-04-05T15:09:49.957051851Z    at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 282
2024-04-05T15:09:49.957100731Z    at MySqlConnector.MySqlCommand.ExecuteNonQuery() in /_/src/MySqlConnector/MySqlCommand.cs:line 101
2024-04-05T15:09:49.957107218Z    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
2024-04-05T15:09:49.957112221Z    at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
2024-04-05T15:09:49.957117078Z    at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
2024-04-05T15:09:49.957122296Z    at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateTables()
2024-04-05T15:09:49.957126026Z    at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()
2024-04-05T15:09:49.957130430Z    at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated()
2024-04-05T15:09:49.957134088Z    at Program.<Main>$(String[] args) in /app/src/Presentation/Program.cs:line 51
2024-04-05T15:09:49.957137856Z    at Program.<Main>(String[] args)
2024-04-05T15:09:50.145517634Z /var/lib/librum-server/srv/run.sh: line 4:     8 Aborted                 (core dumped) dotnet Presentation.dll

After which, the container exits. In the DB, it appears that only the AspNetRoles and AspNetUsers tables are created. Since the compose file is set to auto-restart, the container does restart after this errors & assumes the DB has been provisioned without any issue. However, attempting to log into the client fails since the other tables were not created.

Let me know if I can help provide any additional logs or info. Thanks!

Iliannnn commented 4 months ago

Having the same issue.

jpVm5jYYRE1VIKL commented 3 months ago

feels that project dead. same issue

DavidLazarescu commented 3 months ago

The self-hosting support is community maintained, the person who contributed and helped maintaining it doesn't seem to have much time left atm.

I don't have the docker experience and neither time to learn it right now to work on this sadly.

jpVm5jYYRE1VIKL commented 3 months ago

Well in reality it is quite clearly visible initialization bug which is hardcoded in source. And it is really nothing to do with community support. Normally expected to use TEXT or MEDIUMTEXT instead of Varchar to avoid collation issues binded with utf8mb4.

DavidLazarescu commented 3 months ago

Feel free to open a PR for that and I'd happily merge it

jpVm5jYYRE1VIKL commented 3 months ago

one PR will be not enough because ORM datamodel for selfhosted is broken. It will be much more profit if just clone your real working database with mysqldump and publish it. Because for selfhosted your create with broken ORM but for production you just clone working schema.

tbleiker commented 3 months ago

Same here... selfhosted setup does not work.