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

NullReferenceException in SNIPacket.ReadFromStreamAsync #2026

Closed
MahmudX opened this issue May 1, 2023 · 7 comments
Closed

NullReferenceException in SNIPacket.ReadFromStreamAsync #2026

MahmudX opened this issue May 1, 2023 · 7 comments
Labels
⏳ Waiting for Customer We're waiting for your response :) ℹ️ Needs more Info Waiting on additional information

Comments

@MahmudX
Copy link

MahmudX commented May 1, 2023

Sentry is reporting this issue a lot (below the exact stack trace). Can you help?

System.NullReferenceException: Object reference not set to an instance of an object.
  ?, in void SNIPacket.ReadFromStreamAsync(Stream stream, SNIAsyncCallback callback)
  ?, in uint SNITCPHandle.ReceiveAsync(ref SNIPacket packet)
  ?, in uint SNIMarsConnection.ReceiveAsync(ref SNIPacket packet)
  ?, in void SNIMarsConnection.HandleReceiveComplete(SNIPacket packet, uint sniErrorCode)
  ?, in void SNIPacket.ReadFromStreamAsync(Stream stream, SNIAsyncCallback callback)+(Task<int> t) => { }
  File "Task.cs", line 2381, in void Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)
@JRahnama JRahnama added untriaged ℹ️ Needs more Info Waiting on additional information labels May 1, 2023
@JRahnama
Copy link
Member

JRahnama commented May 1, 2023

@MahmudX can you provide more info and possibly a repro that could help us reproducing the issue?

@JRahnama JRahnama added ⏳ Waiting for Customer We're waiting for your response :) and removed untriaged labels May 2, 2023
@JRahnama
Copy link
Member

JRahnama commented May 8, 2023

From the error message I could say this is similar to issue #422. Can you follow on that thread if you see similarity please.

@SuperXCode
Copy link

The error is still there

Object reference not set to an instance of an object

at System.Data.SqlClient.SNI.SNIPacket.WriteToStream (System.IO.Stream stream) [0x00000] in :0
at System.Data.SqlClient.SNI.SNITCPHandle.Send (System.Data.SqlClient.SNI.SNIPacket packet) [0x0000c] in :0
at System.Data.SqlClient.SNI.SNIMarsConnection.Send (System.Data.SqlClient.SNI.SNIPacket packet) [0x0000c] in :0
at System.Data.SqlClient.SNI.SNIMarsHandle.SendControlPacket (System.Data.SqlClient.SNI.SNISMUXFlags flags) [0x00034] in :0
at System.Data.SqlClient.SNI.SNIMarsHandle.Dispose () [0x00014] in :0
at System.Data.SqlClient.SNI.TdsParserStateObjectManaged.Dispose () [0x00052] in :0
at System.Data.SqlClient.TdsParserSessionPool.PutSession (System.Data.SqlClient.TdsParserStateObject session) [0x00020] in :0
at System.Data.SqlClient.TdsParser.PutSession (System.Data.SqlClient.TdsParserStateObject session) [0x00008] in :0
at System.Data.SqlClient.TdsParserStateObject.CloseSession () [0x0000c] in :0
at System.Data.SqlClient.SqlCommand.PutStateObject () [0x00011] in :0
at System.Data.SqlClient.SqlCommand.ReliablePutStateObject () [0x00000] in :0
at System.Data.SqlClient.SqlCommand.EndExecuteReader (System.IAsyncResult asyncResult) [0x00022] in :0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <509dd36094194d04bf311b5a53d207f9>:0

@David-Engel
Copy link
Contributor

We don't support SDS in this repo. If it can be repro'd in MDS, please file an issue.

@David-Engel David-Engel closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2024
@johnwc
Copy link

johnwc commented Sep 21, 2024

We are seeing this in our logging as well. What is causing it? @David-Engel what does SDS and MDS stand for?

@johnwc
Copy link

johnwc commented Sep 21, 2024

The stack trace from Entity Framework 8.0.8.

System.NullReferenceException: Object reference not set to an instance of an object.
  File "SNITcpHandle.cs", line 902, in uint SNITCPHandle.ReceiveAsync(ref SNIPacket packet)
    packet.ReadFromStreamAsync(_stream);
  File "SNIMarsConnection.cs", line 144, in uint SNIMarsConnection.ReceiveAsync(ref SNIPacket packet)
    return response;
  File "SNIMarsConnection.cs", line 342, in void SNIMarsConnection.HandleReceiveComplete(SNIPacket packet, uint sniErrorCode)
    sniErrorCode = ReceiveAsync(ref packet);
  File "Task.cs", line 2349, in void Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)
    ExecutionContext.RunFromThreadPoolDispatchLoop(threadPoolThread, ec, s_ecCallback, this);

@JRahnama
Copy link
Member

what does SDS and MDS stand for?

SDS: System.Data.SqlClient
MDS: Microsoft.Data.SqlClient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⏳ Waiting for Customer We're waiting for your response :) ℹ️ Needs more Info Waiting on additional information
Projects
Development

No branches or pull requests

5 participants