You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Chris Howard <ch...@facilita.co.uk> on 2010/09/10 12:30:11 UTC

C# messaging client failing to close connection

  Hi,

I am using qpid 0.7 (built from source a few weeks ago). I have a C# 
client that uses the messaging API.  It connects to the broker like so:

Connection connection = new Connection(this.engineArguments.Url);
connection.SetOption("username", this.engineArguments.Username);
connection.SetOption("password", this.engineArguments.Password);
connection.SetOption("reconnect", true);
connection.Open();
this.session = connection.CreateSession();

A number of message are then sent/received, and then, some time later, I 
call the Close() method on the connection object. However, the Close() 
method never returns, and the process hangs indefinitely.

My first thought was that one or more of the messages that were sent 
could still be outstanding, so I added some code to close the session first:

if (this.session != null)
{
     this.session.Sync(true);
     this.session.Close();
}

connection.Close();

The session closes OK, but the call to connection.Close() still hangs.

I then tried removing the following line:

connection.SetOption("reconnect", true);

Now the connection.Close() method does return. However, the code then 
hangs at a different location on the GC thread during program shut down.

// cpp\bindings\qpid\dotnet\src\Message.cpp, line 150

// Destroys kept
// TODO: add lock
void Message::Cleanup()
{
     if (NULL != messagep)
     {
         delete messagep; // hangs on this line
         messagep = NULL;
     }
}

Can anyone suggest what may be happening here. Let me know if I can 
provide any more useful information.

Regards,
Chris



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org