.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

SQLFreeStmt hang

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :


I have an existing (multithreaded) code which is fetching data using ODBC API calls. The problem is that it hangs occasionally.

I have taken a hang dump, which tells me that the application is hung on SQLFreeStmt(hstmt, SQL_DROP), which in turn is hung on ntdll!RtlpWaitOnCriticalSection. From my application logs, I could deduce that the hang occurs sometime after I call SQLCancel(hstmt) from another thread which was actually fetching data. I had to call SQLCancel due to some error in my application. So far, whenever the application hangs, it contains such a cancelled statement some time before SQLFreeStmt.

I am not sure whether my code is aborting the executing statement in correct way and whether cancelling the running query attached to the hstmt will invalidate the handle or leave any lock on the valid handle? Also, what will happen if we pass an invalid handle to SQLFreeStmt.

I would highly appreciate your help here.



View Complete Post

More Related Resource Links

VS 2010-Fix for hang on debugging ASP.Net 3.5 Apps.


Just got this in an email from Microsoft:

Greetings from Microsoft Connect!
This notification was generated for feedback item: VS 2010 - Hangs when debugging ASP.Net 3.5 web application or website which you submitted at the Microsoft Connect site.
The fix for this is now available for download and install from https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=30738&wa=wsignin1.0
Best Regards,
Visual Studio Debugger

Note: The fix for this issue was packaged with the fix for another issue, the KB article currently only lists the other issue, but this download does contain both fixes
You may receive a general "Feedback Item Updated" notification as well, if any other changes were made by Microsoft.
Thank you for using Microsoft Connect!
the Microsoft Connect Team



Custom UsernamePasswordValidator causes IIS Application Pool to hang.

I have a WCF service hosted in IIS (IIS 7 with .NET 3.5 SP1) that uses a custom UsernamePasswordValidator to validate message credentials against a database. The problem is that it works for a while, but over a period of time IIS stops responding to all client requests until the application pool is recycled. The IIS worker process has some requests that get stuck in the "AuthenticateRequest" pipeline state of the "ServiceModel" module. In my testing, I can consistantly reproduce the problem by forcing a client to create a new service proxy with a different username and password and calling the WCF service every few seconds. To troubleshoot I created a new project and removed all of the authentication code in the Validate function so that the UsernamePasswordValidator will accept any username and password combination without throwing an exception, but IIS still hangs: namespace WcfTestService { public class CustomValidator : UserNamePasswordValidator { public override void Validate(string userName, string password){//code removed for testing} } } If I remove the ServiceCredentials node from the Service Behavior, IIS doesn't hang anymore, but there is no user validation that takes place either, which is a problem. Here is the service binding configuration: <services> <service name=&

.Net Regex engine seems to hang for the given expression and input

Provided pattern:


Input Test
public List<String> TestFunction(string input, List<String> CategoryList, object[] obj)

Please provide an earliest answer/remedy for the provided expression. I have tried to find relevant documentation of bugs but have not found any clues. Tested on regex test engines as well. But behavior happens to be same in all the cases.


Listener hang up when serving more clients


Dear all, I have a problem on TCP/IP connection on C# under .NET 3.5 (VS 2008). I apologize for the long question.

I put up and running a TCPListener and then I keep sending some sample data from TWO sources TCPClient. The listener is very simple and shown in the following console application:

      IPEndPoint LocalEndPointToListen = new IPEndPoint(IPAddress.Parse(""), 12100);
      TcpListener listener = null;
      listener = new TcpListener(LocalEndPointToListen);
      Byte[] rcvBuffer = new byte[10240]; // Receive buffer
      while (true)
        Int32 bytesRcvd = 0; // Received byte count
        Int32 totalBytesRcvd = 0; // Total bytes received so far
        while (listener.Pending() == true) { Thread.Sleep(50); }
        TcpClient client = listener.AcceptTcpClient(); 

FtpWebRequest.GetRequestStream hang up?


I use FtpWebRequest to upload a file to a ftp server. It works for a local server but not a remote server.

It hang up for a while when I debug to the call .GetRequestStream, then threw an exception which did not help becuase it just said "System error".

Here is the StackTrace:

 at System.Net.PooledStream.PrePush(Object expectedOwner) at System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse) at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage) at System.Net.FtpWebRequest.SyncRequestCallback(Object obj) at System.Net.FtpWebRequest.RequestCallback(Object obj) at System.Net.CommandStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.Stream.Dispose() at System.Net.ConnectionPool.Destroy(PooledStream pooledStream) at System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse) at System.Net.FtpWebRequest.AttemptedRecovery(Exception e) at System.Net.FtpWebRequest.SubmitRequest(Boolean async)

It works fine when I use FileZilla to upload a file.

I tried to change .UsePassive and .Proxy.

is it a ftp server configuration issue? I believe it is a ms ftp server.


Terranium? What is it and why does it hang during update


A few days ago I restarted my computer and a new process called Terranium updater setup started running immediately after the restart. It hangs halfway through the update and never finishes. The process associated with this is messenger.exe in the C drive, a 92kb application. 


A couple of issues:


1) What in the world is Terranium? I didn't install this or install any new software on my computer. No shady links, etc. All virus scanners (this might sound silly but seeing as how I didn't put this on my computer on purpose nor can I uninstall it) show nothing wrong.


2) Why won't it finish? It hangs just under 50% of the update bar. I have to force quit the process after quite some time just to make it go away.


The window is just a little gray box, says "Terranium updater Setup: Installing". There is a little icon that looks like a lock or timer of some sort, half of it is light gray and the other half is dark gray. 

I've tried Googling to see what this is or if anyone else has any issues but have come up with nothing. I called a friend who works for a large corporation IT and all he can do is confirm that it's a "safe" application, something to do with .Net Framework but has no answers as to why it's there or how to make it finish or go away.


Using a CREATEd ASSEMBLY causes SQL Server to hang permanently


Hi everyone,

this one's a bit difficult to explain, especially for a non-native english speaker:

I want to use some elliptic-curve-based digital signature functions of the C# implementation of the BouncyCastle crypto library (http://www.bouncycastle.org/csharp/); I wrote a small C# wrapper class that has the following methods:

  • public static void generateKeyPair(out byte[] private_key, out byte[] public_key)
  •  public static void SignData(byte[] data, byte[] private_key, out byte[] signature)
  •  public static void VerifyData(byte[] signature, byte[] data, byte[] public_key, out bool ok)
which all access the actual BouncyCastle library, BouncyCastle.Crypto.dll. Then I
  • created a "Visual Studio Strong Name Key File" and<
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend