Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
jonnyrim #1
Member since Oct 2005 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: StackOverflowExeption in agsxmpp.dll
Hi Alex,

Great job with the library so far.

Am using it in VS.NET 2003 and using your latest binary (0.500) for Desktop.

I am noticing that when i Send() a message to a GoogleTalk user that is not currently available, the library throws an exception:

An unhandled exception of type 'System.StackOverflowException' occurred in agsxmpp.dll

When i check the call stack, it shows:

>    agsxmpp.dll!agsXMPP.XmppClientConnection.streamParser_OnStreamElement(System.Object sender = {agsXMPP.StreamParser}, agsXMPP.Xml.Dom.Node e = {agsXMPP.protocol.client.Message}) Line 1016 + 0x23 bytes    C#
     agsxmpp.dll!agsXMPP.StreamParser.EndTag(byte[] buf = {Length=489}, int offset = 479, agsXMPP.Xml.xpnet.ContentToken ct = {agsXMPP.Xml.xpnet.ContentToken}, agsXMPP.Xml.xpnet.TOK tok = END_TAG) Line 356    C#
     agsxmpp.dll!agsXMPP.StreamParser.Push(byte[] buf = {Length=1024}, int offset = 0, int length = 489) Line 141    C#
     agsxmpp.dll!agsXMPP.XmppClientConnection.m_ClientSocket_OnReceive(System.Object sender = {agsXMPP.net.ClientSocket}, byte[] data = {Length=1024}, int count = 489) Line 557 + 0x18 bytes    C#
     agsxmpp.dll!agsXMPP.net.ClientSocket.EndReceive(System.IAsyncResult ar = {System.IO.Stream.SynchronousAsyncResult}) Line 303    C#
     mscorlib.dll!System.IO.Stream.BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback callback, System.Object state) + 0xbf bytes   
     mono.security.dll!Mono.Security.Protocol.Tls.SslClientStream.BeginRead(byte[] buffer = {Length=1024}, int offset = 0, int count = 1024, System.AsyncCallback callback = {System.AsyncCallback}, System.Object state = <undefined value>) + 0x30d bytes   
     agsxmpp.dll!agsXMPP.net.ClientSocket.Receive() Line 287 + 0x37 bytes    C#
     agsxmpp.dll!agsXMPP.net.ClientSocket.EndReceive(System.IAsyncResult ar = {System.IO.Stream.SynchronousAsyncResult}) Line 304 + 0x8 bytes    C#


The client code I use to call is this:

                    // create  msg and send
                    agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message((string) rdr["GtalkId"], agsXMPP.protocol.client.MessageType.chat, sentence);
                    msg.Thread = rdr["ID"].ToString();
                    xmpp.Send(msg);


In an older version of your library, this did not seem to happen.  Now, it seems to only happen if the recipient of the message is not currently online.

Any insight on this?

Thanks!
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi,

could you post the debug XML here?
Dont think the error is from the message you send. I assume google is sending a message back to you which tells you the message is stored offline or smth else.
Btw, latest version is 0.6. But the solution files are for VS2005 now. But it should be very easy to update your all files with the latest code.

Alex
Avatar
jonnyrim #3
Member since Oct 2005 · 6 posts
Group memberships: Members
Show profile · Link to this post
hi alex,

the last XML i receive is:

    xml    "<message xmlns=\"jabber:client\" from=\"unavailableuserbob@gmail.com\" to=\"originatinguser@gmail.com/originatinguserBE2D2001\" type=\"error\"><body>Yo! my test message</body><thread>3</thread><error code=\"503\" type=\"cancel\"><service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\" /><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">Recipient unavailableuserbob@gmail.com is unavailable</text></error></message>"    string

Then, VS.Net 2003 says:

An unhandled exception of type 'System.StackOverflowException' occurred in agsxmpp.dll

and points me to:

streamParser_OnStreamElement() in xmppClientConnection.cs:
...
else if ( e.GetType() == typeof(Message) )
            {
                if (OnMessage != null)
            ------->        OnMessage(this, e as Message);
            }
...

I guess I can code my client to handle UnAvailable message types to prevent this from happening but I wanted to let you know that previously, sending to unavailable users did not result in an unhandled exception.

thanks!
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi jonnyrim,

i dont think this exception comes from agsXMPP.
Google returns you an error message. It looks like they dont support offline messages. So they dont accept the message and return it to you with an error. All other xmpp servers normally store the message offline and deliver it once the user is available.
You should get an OnMessage event here. Is it possible that your OnMessage handler causes an exception when it gets this message?
When the exception is thrown in your OnMessage handler and you don't handle it, .NET will pass it to the next instance, and this is agsXMPP.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
i just tried your scenario and had no problems. If you show us your code we could take a closer look at it.

Alex
Avatar
jonnyrim #6
Member since Oct 2005 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: hmm
hi alex,

thanks for looking into this. i'll look further to see if it is really coming from my onMessage Handler.  I didn't see it being entered but i'll take a better look.

thanks!
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS