Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State Report Trace doesn't match the format string #939

Closed
lbargery opened this issue Mar 2, 2021 · 4 comments · Fixed by #940
Closed

State Report Trace doesn't match the format string #939

lbargery opened this issue Mar 2, 2021 · 4 comments · Fixed by #940

Comments

@lbargery
Copy link

lbargery commented Mar 2, 2021

Describe the bug

I've been debugging an issue with MARs recently where despite MARs being set to false, the connections still seem to run with _pMarsPhysicalConObj. To try and get further information on this, I turned on verbose logging with a SQL listener and discovered your format string and output are mismatched.

Inside the method TraceString inside TdsParser.cs you have an extra "" for the log which throws things off and you see as the output I get

 _physicalStateObj = False
	         _pMarsPhysicalConObj = True
	         _state = OpenLoggedIn
	         _server = tcp:HIDDEN.database.windows.net,1433
	         _fResetConnection = False
	         _defaultCollation = (LCID=1033, Opts=25)
	         _defaultCodePage = 1252
	         _defaultLCID = 1033
	         _defaultEncoding = System.Text.SBCSCodePageEncoding
	         _encryptionOption = 
	         _currentTransaction = ON
	         _pendingTransaction = (null)
	         _retainedTransactionId = (null)
	         _nonTransactedOpenResultCount = 0
	         _connHandler = 0
	         _fMARS = 75
	         _sessionPool = False
	         _isYukon = (null)
	         _sniSpnBuffer = True
	         _errors = (null)
	         _warnings = (null)
	         _attentionErrors = (null)
	         _attentionWarnings = (null)
	         _statistics = (null)
	         _statisticsIsInTransaction = True
	         _fPreserveTransaction = False         _fParallel = False"

As you can see, _fMars is coming out as 75 and isYukon as (null). I believe they are all shifted by one.

To reproduce

Not needed really - bug is clear I hope!

Expected behavior

Log should print correctly

Further technical details

Microsoft.Data.SqlClient version: 2.1.1
.NET core: 3.1

@cheenamalhotra
Copy link
Member

Thanks @lbargery
We'll get that addressed soon!

@lbargery
Copy link
Author

lbargery commented Mar 2, 2021

Thanks @lbargery
We'll get that addressed soon!

Thanks! If you do shift them up you get _fMARS is false but _pMarsPhysicalConObj is true. Any pointers on how this could happen? Trying to debug myself before raising another issue :)

@cheenamalhotra
Copy link
Member

It's just weirdly written..

null == _pMarsPhysicalConObj ? bool.TrueString : bool.FalseString

you'd expect "true" when _fMars is false.

I'll see what I can do to make more sense..

@lbargery
Copy link
Author

lbargery commented Mar 2, 2021

Ah I see! Thanks, that's helpful with debugging further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants