bitwarden / server

Bitwarden infrastructure/backend (API, database, Docker, etc).
https://bitwarden.com
Other
15.25k stars 1.27k forks source link

reboot loop for mssql docker container #476

Closed gammons closed 5 years ago

gammons commented 5 years ago

Hi there, I'm attempting a fresh new install on Ubuntu 18.10. The mssql server is in a boot loop. Here's the logs:

bitwarden-admin  |       Database unavailable for migration. Trying again (attempt #4)...
bitwarden-admin  | System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was
not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal exception was caught) ---> Syste
m.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 6): No such device or address
bitwarden-admin  |    at System.Net.Dns.InternalGetHostByName(String hostName)
bitwarden-admin  |    at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
bitwarden-admin  |    at System.Data.SqlClient.SNI.SNITCPHandle.Connect(String serverName, Int32 port, TimeSpan timeout)
bitwarden-admin  |    at System.Data.SqlClient.SNI.SNITCPHandle..ctor(String serverName, Int32 port, Int64 timerExpire, Object callbackObject, Boolean parallel)
bitwarden-admin  |    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, St
ring newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
bitwarden-admin  |    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbCon
nection owningConnection, DbConnectionOptions userOptions)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey,
DbConnectionOptions userOptions)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection,
 DbConnectionOptions userOptions, DbConnectionInternal& connection)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& conne
ction)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal
 oldConnection, DbConnectionInternal& connection)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbCon
nectionOptions userOptions)
bitwarden-admin  |    at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOpt
ions userOptions)
bitwarden-admin  |    at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
bitwarden-admin  |    at System.Data.SqlClient.SqlConnection.Open()
bitwarden-admin  |    at Bit.Migrator.DbMigrator.MigrateMsSqlDatabase(Boolean enableLogging, CancellationToken cancellationToken) in /home/appveyor/projects/server/util/Migrator/DbMigrator.cs:line 41
bitwarden-admin  |    at Bit.Admin.HostedServices.DatabaseMigrationHostedService.StartAsync(CancellationToken cancellationToken) in /home/appveyor/projects/server/src/Admin/HostedServices/DatabaseMigra
tionHostedService.cs:line 40
bitwarden-admin  | ClientConnectionId:00000000-0000-0000-0000-000000000000

I'm not sure what the next step is to debug. The only (maybe) interesting outlier is that the docker containers are being run from within an lxc container, but I'm not sure why that would make a different.

Any help/pointers to move forward would be appreciated! Thanks.

kspearrin commented 5 years ago

Seems like the mssql container is not running. What does docker ps show?

gammons commented 5 years ago

the logs above are from the mssql container. It does run, for about 3 seconds, and then reboots.

gammons commented 5 years ago

there are mssql error longs in the bwdata directory. Here's an example of one of those:

2019-04-11 00:53:25.44 Server      Microsoft SQL Server 2017 (RTM-CU12) (KB4464082) - 14.0.3045.24 (X64)
        Oct 18 2018 23:11:05
        Copyright (C) 2017 Microsoft Corporation
        Express Edition (64-bit) on Linux (Ubuntu 16.04.5 LTS)
2019-04-11 00:53:25.44 Server      UTC adjustment: 0:00
2019-04-11 00:53:25.44 Server      (c) Microsoft Corporation.
2019-04-11 00:53:25.44 Server      All rights reserved.
2019-04-11 00:53:25.44 Server      Server process ID is 4124.
2019-04-11 00:53:25.44 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2019-04-11 00:53:25.44 Server      Registry startup parameters:
         -d /var/opt/mssql/data/master.mdf
         -l /var/opt/mssql/data/mastlog.ldf
         -e /var/opt/mssql/log/errorlog
2019-04-11 00:53:25.45 Server      Error: 17113, Severity: 16, State: 1.
2019-04-11 00:53:25.45 Server      Error 87(The parameter is incorrect.) occurred while opening file '/var/opt/mssql/data/master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.
gammons commented 5 years ago

my issue is a dupe of #282.