dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Invoke-DbaQuery segfaults on Linux with PowerShell 7.2 when using Kerberos auth

Open ajansveld opened this issue 3 years ago • 1 comments

Verified issue does not already exist?

Yes

What error did you receive?

Segmentation fault (core dumped) EXIT STATUS 139

Steps to Reproduce

Invoke-DbaQuery -SqlInstance myserver -Query 'USE AdventureWorks2017; SELECT TOP 10 * FROM Sales.SalesOrderHeader'

Are you running the latest release?

Yes

Other details or mentions

This is a known issue: https://github.com/dotnet/SqlClient/issues/1390. It was fixed in Microsoft.Data.SqlClient v4.0.1, can we upgrade the bundled package to the latest version?

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Linux 3.10.0-1160.53.1.el7.jane2.x86_64 #1 SMP Thu Jan 20 14:27:34 HKT 2022
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

SQL Server Edition and Build number

Microsoft SQL Server 2017 (RTM-CU28) (KB5008084) - 14.0.3430.2 (X64)
        Dec 17 2021 14:30:27
        Copyright (C) 2017 Microsoft Corporation
        Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor)

.NET Framework Version

.NET 6.0.0-rtm.21522.10

ajansveld avatar Feb 15 '22 17:02 ajansveld

I get the same error from docker

danpousson avatar Apr 04 '22 04:04 danpousson

This was supposedly fixed in Microsoft.Data.SqlClient v4.0.1 (and System.Data.SqlClient v4.8.4). Are there any plans to update to that (or the latest) version?

ajansveld avatar Oct 17 '22 19:10 ajansveld

That is what I'm working on now, actually -- trying to get it to System.Data.SqlClient 5.0 but I'm in DLL hell. I imagine I'll figure it out by the weekend. For reference (tho I have new problems): https://github.com/microsoft/sqlmanagementobjects/issues/114

potatoqualitee avatar Oct 18 '22 07:10 potatoqualitee

Have there been any updates to this? I too am experiencing seg faults when running a simple Invoke-DbaQuery call in PS 7.3.0 on Centos 7.

garyhampson avatar Dec 13 '22 04:12 garyhampson

@garyhampson yes, this will be resolved when dbatools 2.0 is released in the upcoming weeks. I have tested invoke-dbaquery with success.

potatoqualitee avatar Dec 13 '22 07:12 potatoqualitee

PS /mnt/c/github> kinit -l 9h  -r  6d [email protected]
Password for [email protected]:
PS /mnt/c/github> ipmo ../gallery/dbatools.core.library
PS /mnt/c/github> ipmo ./dbatools

PS /mnt/c/github> Connect-DbaInstance -SqlInstance sqlcs

ComputerName Name  Product              Version   HostPlatform IsAzure IsClustered ConnectedAs
------------ ----  -------              -------   ------------ ------- ----------- -----------
sqlcs        sqlcs Microsoft SQL Server 15.0.4236 Windows      False   False       AD\cl

PS /mnt/c/github> Invoke-DbaQuery -SqlInstance sqlcs -Query "select 1"

Column1
-------
      1

gonna mark this as done but you'll have to wait for dbatools 2.0 in the gallery before it'll work

potatoqualitee avatar Dec 13 '22 07:12 potatoqualitee

Thanks @potatoqualitee - Do we know when 2.0 will be made available? Just curious if I should try to work around this issue for now or wait for it to be released.

garyhampson avatar Dec 13 '22 16:12 garyhampson

it'll probably be about 2 weeks, @garyhampson

potatoqualitee avatar Dec 13 '22 21:12 potatoqualitee