bitwarden / self-host

Bitwarden's self-hosted release repository
GNU General Public License v3.0
351 stars 63 forks source link

Unexpected error when logging into server #206

Open RonV42 opened 9 months ago

RonV42 commented 9 months ago

Running on Proxmox and did the latest pull from Docker and every client receives "unepxected error" when logging though web. Clients fail on error when logging in from mobile device and the chrome plugin. I started the docker container to view the output and there is a repeating aborted connection message which I was also seeing in the December builds but no additional items that lead to why the error is happening. I rolled back to December and client login is working again. Let me know what addition info you need.

The old version I migrated from was: Version 2023.12.0 The version from docker hub latest "beta" tag

bitwarden-bitwarden-1  | 2024-01-31 15:58:12,690 INFO success: admin entered RUNNING state, process has stayed up for > than 15 seconds (startsecs)
bitwarden-db-1         | 2024-01-31 15:58:20 64 [Warning] Aborted connection 64 to db: 'unconnected' user: 'bitwarden' host: '172.18.0.3' (Got an error reading communication packets)
bitwarden-db-1         | 2024-01-31 15:58:20 66 [Warning] Aborted connection 66 to db: 'bitwarden_vault' user: 'bitwarden' host: '172.18.0.3' (Got an error reading communication packets)
bitwarden-bitwarden-1  | 2024-01-31 15:58:21,408 INFO exited: admin (terminated by SIGABRT (core dumped); not expected)
bitwarden-bitwarden-1  | 2024-01-31 15:58:22,410 INFO spawned: 'admin' with pid 572
bitwarden-bitwarden-1  | 2024-01-31 15:58:37,429 INFO success: admin entered RUNNING state, process has stayed up for > than 15 seconds (startsecs)
bitwarden-db-1         | 2024-01-31 15:58:45 70 [Warning] Aborted connection 70 to db: 'bitwarden_vault' user: 'bitwarden' host: '172.18.0.3' (Got an error reading communication packets)
bitwarden-db-1         | 2024-01-31 15:58:45 68 [Warning] Aborted connection 68 to db: 'unconnected' user: 'bitwarden' host: '172.18.0.3' (Got an error reading communication packets)
bitwarden-bitwarden-1  | 2024-01-31 15:58:46,312 INFO exited: admin (terminated by SIGABRT (core dumped); not expected)
bitwarden-bitwarden-1  | 2024-01-31 15:58:47,315 INFO spawned: 'admin' with pid 594
bitwarden-bitwarden-1  | 2024-01-31 15:59:02,333 INFO success: admin entered RUNNING state, process has stayed up for > than 15 seconds (startsecs)
bitwarden-db-1         | 2024-01-31 15:59:10 72 [Warning] Aborted connection 72 to db: 'unconnected' user: 'bitwarden' host: '172.18.0.3' (Got an error reading communication packets)
bitwarden-db-1         | 2024-01-31 15:59:10 74 [Warning] Aborted connection 74 to db: 'bitwarden_vault' user: 'bitwarden' host: '172.18.0.3' (Got an error reading communication packets
Greenderella commented 9 months ago

Hi there,

I assume you are running a unified server. By any chance are you seeing this error in your admin logs? https://github.com/bitwarden/server/issues/3651#issuecomment-1880099559

RonV42 commented 9 months ago

Yes I just shelled into the docker container and dumped the admin log and getting the same type of errors.

fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      CALL POMELO_BEFORE_DROP_PRIMARY_KEY(NULL, 'Grant');
      ALTER TABLE `Grant` DROP PRIMARY KEY;
Unhandled exception. MySqlConnector.MySqlException (0x80004005): Can't DROP INDEX `PRIMARY`; check that it exists
   at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 43
   at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 130
   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 468
   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
   at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 296
   at MySqlConnector.MySqlCommand.ExecuteNonQuery() in /_/src/MySqlConnector/MySqlCommand.cs:line 107
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Bit.MySqlMigrations.MySqlDbMigrator.MigrateDatabase(Boolean enableLogging, CancellationToken cancellationToken) in /source/util/MySqlMigrations/MySqlDbMigrator.cs:line 30
   at Bit.Admin.HostedServices.DatabaseMigrationHostedService.StartAsync(CancellationToken cancellationToken) in /source/src/Admin/HostedServices/DatabaseMigrationHostedService.cs:line 29
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Bit.Admin.Program.Main(String[] args) in /source/src/Admin/Program.cs:line 9
RonV42 commented 9 months ago

After reading thought that topic the question I have is what is the correct procedure to resolve?

Shutdown December version of Bitwarden, Pull lastest beta, Start the containers and then run the SQL

or

Shutdown only the Bitwarden container in the December build, run the SQL, pull the latest beta, start containers

The SQL I assume to be run in the MariaDB container is:

mysql -h localhost -P 3306 --protocol=tcp -u bitwarden -p bitwarden_vault
ALTER TABLE `Grant` DROP COLUMN `Id`;
ALTER TABLE `Grant` ADD PRIMARY KEY `PK_Grant` (`Key`); 
Greenderella commented 9 months ago

If you are running the December release, you can just do a standard upgrade, and you shouldn't see an issue.

RonV42 commented 9 months ago

Just pulled and started containers. Still seeing the SQL Errors:

fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
      Failed executing DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      CALL POMELO_BEFORE_DROP_PRIMARY_KEY(NULL, 'Grant');
      ALTER TABLE `Grant` DROP PRIMARY KEY;
Unhandled exception. MySqlConnector.MySqlException (0x80004005): Can't DROP INDEX `PRIMARY`; check that it exists
   at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 43
   at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 130
   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 468
   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
   at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 296
   at MySqlConnector.MySqlCommand.ExecuteNonQuery() in /_/src/MySqlConnector/MySqlCommand.cs:line 107
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)
   at Bit.MySqlMigrations.MySqlDbMigrator.MigrateDatabase(Boolean enableLogging, CancellationToken cancellationToken) in /source/util/MySqlMigrations/MySqlDbMigrator.cs:line 30
   at Bit.Admin.HostedServices.DatabaseMigrationHostedService.StartAsync(CancellationToken cancellationToken) in /source/src/Admin/HostedServices/DatabaseMigrationHostedService.cs:line 29
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Bit.Admin.Program.Main(String[] args) in /source/src/Admin/Program.cs:line 9
wardragon commented 9 months ago

I opened thicket #197, like this. Still have log errors on mysldb. But the mysql upgrade is done even if only upgrade bitwarden container, and not mysql?

cvondraoti commented 8 months ago

Seeing the exact same issue. Need help ASAP as this is my only vault.