microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.72k stars 759 forks source link

setting collation causes deadlock #125

Closed coderb closed 7 years ago

coderb commented 7 years ago

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_COLLATION=Latin1_General_BIN' -e 'MSSQL_SA_PASSWORD=<YoerStrbng!PaJsw0rd>' -e 'MSSQL_PID=Developer' --cap-add SYS_PTRACE -p 1433:1433 -d microsoft/mssql-server-linux

gives error in log:

2017-07-20 08:14:29.48 Server Microsoft SQL Server 2017 (RC1) - 14.0.800.90 (X64) Jul 11 2017 07:03:16 Copyright (C) 2017 Microsoft Corporation. All rights reserved. Developer Edition (64-bit) on Linux (Ubuntu 16.04.2 LTS) 2017-07-20 08:14:29.48 Server UTC adjustment: 0:00 2017-07-20 08:14:29.48 Server (c) Microsoft Corporation. 2017-07-20 08:14:29.48 Server All rights reserved. 2017-07-20 08:14:29.48 Server Server process ID is 4116. 2017-07-20 08:14:29.48 Server Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'. 2017-07-20 08:14:29.48 Server Registry startup parameters: -d /var/opt/mssql/data/master.mdf -l /var/opt/mssql/data/mastlog.ldf -e /var/opt/mssql/log/errorlog 2017-07-20 08:14:29.49 Server SQL Server detected 1 sockets with 1 cores per socket and 1 logical processors per socket, 1 total logical processors; using 1 logical processors based on SQL Server licensing. This is an informational message; no user action is required. 2017-07-20 08:14:29.49 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required. 2017-07-20 08:14:29.49 Server Detected 3150 MB of RAM. This is an informational message; no user action is required. 2017-07-20 08:14:29.49 Server Using conventional memory in the memory manager. 2017-07-20 08:14:29.62 Server Buffer pool extension is already disabled. No action is necessary. 2017-07-20 08:14:29.69 Server InitializeExternalUserGroupSid failed. Implied authentication will be disabled. 2017-07-20 08:14:29.69 Server Implied authentication manager initialization failed. Implied authentication will be disabled. 2017-07-20 08:14:29.69 Server Successfully initialized the TLS configuration. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are ['ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA']. 2017-07-20 08:14:29.71 Server The maximum number of dedicated administrator connections for this instance is '1' 2017-07-20 08:14:29.71 Server Node configuration: node 0: CPU mask: 0x0000000000000001:0 Active CPU mask: 0x0000000000000001:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required. 2017-07-20 08:14:29.72 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required. 2017-07-20 08:14:29.73 Server In-Memory OLTP initialized on lowend machine. 2017-07-20 08:14:29.76 Server Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required. 2017-07-20 08:14:29.77 Server Query Store settings initialized with enabled = 1, 2017-07-20 08:14:29.77 spid6s Starting up database 'master'. 2017-07-20 08:14:29.79 Server Software Usage Metrics is disabled. 2017-07-20 08:14:29.97 spid6s The tail of the log for database master is being rewritten to match the new sector size of 4096 bytes. 3072 bytes at offset 418816 in file /var/opt/mssql/data/mastlog.ldf will be written. 2017-07-20 08:14:30.05 spid6s Converting database 'master' from version 862 to the current version 869. 2017-07-20 08:14:30.05 spid6s Database 'master' running the upgrade step from version 862 to version 863. 2017-07-20 08:14:30.06 spid6s Database 'master' running the upgrade step from version 863 to version 864. 2017-07-20 08:14:30.08 spid6s Database 'master' running the upgrade step from version 864 to version 865. 2017-07-20 08:14:30.08 spid6s Database 'master' running the upgrade step from version 865 to version 866. 2017-07-20 08:14:30.09 spid6s Database 'master' running the upgrade step from version 866 to version 867. 2017-07-20 08:14:30.09 spid6s Database 'master' running the upgrade step from version 867 to version 868. 2017-07-20 08:14:30.09 spid6s Database 'master' running the upgrade step from version 868 to version 869. 2017-07-20 08:14:30.27 spid6s Buffer pool extension is already disabled. No action is necessary. 2017-07-20 08:14:30.27 spid6s Resource governor reconfiguration succeeded. 2017-07-20 08:14:30.27 spid6s SQL Server Audit is starting the audits. This is an informational message. No user action is required. 2017-07-20 08:14:30.28 spid6s SQL Server Audit has started the audits. This is an informational message. No user action is required. 2017-07-20 08:14:30.34 spid6s SQL Trace ID 1 was started by login "sa". 2017-07-20 08:14:30.36 spid19s Password policy update was successful. 2017-07-20 08:14:30.36 spid6s Server name is '23cd7ff50680'. This is an informational message only. No user action is required. 2017-07-20 08:14:30.38 spid22s Always On: The availability replica manager is starting. This is an informational message only. No user action is required. 2017-07-20 08:14:30.38 spid22s Always On: The availability replica manager is waiting for the instance of SQL Server to allow client connections. This is an informational message only. No user action is required. 2017-07-20 08:14:30.38 spid9s Starting up database 'mssqlsystemresource'. 2017-07-20 08:14:30.38 spid6s Starting up database 'msdb'. 2017-07-20 08:14:30.39 spid9s The resource database build version is 14.00.800. This is an informational message only. No user action is required. 2017-07-20 08:14:30.41 spid9s Starting up database 'model'. 2017-07-20 08:14:30.65 spid19s A self-generated certificate was successfully loaded for encryption. 2017-07-20 08:14:30.66 spid19s Server is listening on [ 'any' 1433]. 2017-07-20 08:14:30.68 Server Server is listening on [ 127.0.0.1 1434]. 2017-07-20 08:14:30.68 Server Dedicated admin connection support was established for listening locally on port 1434. 2017-07-20 08:14:30.70 spid19s SQL Server is now ready for client connections. This is an informational message; no user action is required. 2017-07-20 08:14:30.72 spid9s The tail of the log for database model is being rewritten to match the new sector size of 4096 bytes. 2048 bytes at offset 75776 in file /var/opt/mssql/data/modellog.ldf will be written. 2017-07-20 08:14:30.73 spid9s Converting database 'model' from version 862 to the current version 869. 2017-07-20 08:14:30.73 spid9s Database 'model' running the upgrade step from version 862 to version 863. 2017-07-20 08:14:30.75 spid9s Database 'model' running the upgrade step from version 863 to version 864. 2017-07-20 08:14:30.76 spid6s The tail of the log for database msdb is being rewritten to match the new sector size of 4096 bytes. 512 bytes at offset 52736 in file /var/opt/mssql/data/MSDBLog.ldf will be written. 2017-07-20 08:14:30.76 spid9s Database 'model' running the upgrade step from version 864 to version 865. 2017-07-20 08:14:30.77 spid6s Converting database 'msdb' from version 862 to the current version 869. 2017-07-20 08:14:30.77 spid6s Database 'msdb' running the upgrade step from version 862 to version 863. 2017-07-20 08:14:30.80 spid6s Database 'msdb' running the upgrade step from version 863 to version 864. 2017-07-20 08:14:30.80 spid9s Database 'model' running the upgrade step from version 865 to version 866. 2017-07-20 08:14:30.80 spid9s Database 'model' running the upgrade step from version 866 to version 867. 2017-07-20 08:14:30.81 spid9s Database 'model' running the upgrade step from version 867 to version 868. 2017-07-20 08:14:30.82 spid6s Database 'msdb' running the upgrade step from version 864 to version 865. 2017-07-20 08:14:30.82 spid9s Database 'model' running the upgrade step from version 868 to version 869. 2017-07-20 08:14:30.82 spid6s Database 'msdb' running the upgrade step from version 865 to version 866. 2017-07-20 08:14:30.82 spid6s Database 'msdb' running the upgrade step from version 866 to version 867. 2017-07-20 08:14:30.83 spid6s Database 'msdb' running the upgrade step from version 867 to version 868. 2017-07-20 08:14:30.83 spid6s Database 'msdb' running the upgrade step from version 868 to version 869. 2017-07-20 08:14:30.92 spid9s Polybase feature disabled. 2017-07-20 08:14:30.92 spid9s Clearing tempdb database. 2017-07-20 08:14:31.23 spid9s Starting up database 'tempdb'. 2017-07-20 08:14:31.35 spid9s The tempdb database has 1 data file(s). 2017-07-20 08:14:31.36 spid24s The Service Broker endpoint is in disabled or stopped state. 2017-07-20 08:14:31.36 spid24s The Database Mirroring endpoint is in disabled or stopped state. 2017-07-20 08:14:31.39 spid24s Service Broker manager has started. 2017-07-20 08:14:31.48 spid6s Recovery is complete. This is an informational message only. No user action is required. 2017-07-20 08:14:31.48 spid22s The default language (LCID 0) has been set for engine and full-text services. 2017-07-20 08:14:31.48 spid22s Warning ** 2017-07-20 08:14:31.48 spid22s Attempting to change default collation to Latin1_General_BIN. 2017-07-20 08:14:34.78 spid11s Error: 1205, Severity: 13, State: 18. 2017-07-20 08:14:34.78 spid11s Transaction (Process ID 11) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. 2017-07-20 08:14:34.78 spid11s An error occurred while configuring engine telemetry: error 1205, severity 25, state 18. 2017-07-20 08:14:34.78 Server An error occurred during server setup. See previous errors for more information. 2017-07-20 08:14:34.79 spid17s SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

twright-msft commented 7 years ago

Do you have the same error with other collations or just Latin1_General_BIN?

coderb commented 7 years ago

it seems so. i just tried the same command with Latin1_General_BIN2 and it deadlocked/failed as well.

twright-msft commented 7 years ago

OK, thanks. Yeah, seeing the same on my machine but the AV happens only with _BIN collations. Both _BIN collations and other collations like Latin1_General_CS_AS_KS_WS throw the deadlock error. We'll look into it further...

coderb commented 7 years ago

good to know i'm not crazy. thanks for the fast response!

twright-msft commented 7 years ago

This is a known issue, documented in the release notes here: https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-release-notes#RC1
There is a workaround in the release notes. Sorry for the inconvenience. The issue is fixed and will be in the next release.

coderb commented 7 years ago

hmm, ok. glad it's fixed however the workaround doesn't work for me. mssql-conf set-collation dies because it tries to run sudo which doesn't exist inside the docker container.

twright-msft commented 7 years ago

Good point. Sorry, about the inconvenience. Next RC with this fix should be out week of July 31.

coderb commented 7 years ago

i'd like to test this under windows. any chance rc2 can get a push to microsoft/mssql-server-windows ?

twright-msft commented 7 years ago

Please use RC1 on Windows for now. We probably wont be publishing an RC2 image to Docker Hub since the delta between RC1 and RC2 is so small.

coderb commented 7 years ago

Is it possible for me to build my own windows RC2 image (instructions please, if so)?

You said RC2 would fix the collation issue- that's why I want RC2 on Windows. How do I test/run it?

twright-msft commented 7 years ago

The collation issue is specific to SQL Server on Linux in RC1. It should be fixed in mssql-server-linux in :rc2.

coderb commented 7 years ago

From what I see, -e MSSQL_COLLATION is not even coded in startup.ps1 on windows RC1. Am I being stupid / missing something? Thanks.

twright-msft commented 7 years ago

Since SQL Server on Windows containers is behind SQL Server on Linux in terms of how configuration options are exposed, if you wanted to set the collation before running SQL Server you would need to build your own image. You can do this by grabbing the Dockerfile here: https://github.com/Microsoft/mssql-docker/blob/master/windows/mssql-server-windows/dockerfile

Then, on the command line where it is passing in various arguments to .\setup\setup.exe you would need to also pass the /SQLCOLLATION parameter. Then docker build and you'll have your own image with whatever collation you want.

Over time, SQL Server on Windows containers will catch up to SQL Server on Linux containers in terms of ease of use in areas like this.

coderb commented 7 years ago

nice! that should work for me. thanks!