kcando / jabber-net

Automatically exported from code.google.com/p/jabber-net
Other
0 stars 0 forks source link

NullRefrenceException in HttpStanzaStream #74

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am getting NullReferenceException in OnRead of HttpStanzaStream class
        bool ISocketEventListener.OnRead(BaseSocket sock, byte[] buf, int 
offset, int length)
        {
            m_listener.BytesRead(buf, offset, length);
            m_elements.Push(buf, offset, length);
            return true;
        }

m_elements is being NULL
I am getting this exception nearly 25% of the time.

JabberNet connection = ConnectionType.HTTP_Binding;
JabberNet version = "2.1.0.702"
Server = OpenFire
OS = Vista
VS.Net 2005

Stack Trace:
"   at 
jabber.connection.HttpStanzaStream.bedrock.net.ISocketEventListener.OnRead
(BaseSocket sock, Byte[] buf, Int32 offset, Int32 length) in 
D:\\Programs\\Jabber-
Net\\src\\jabber\\connection\\HttpStanzaStream.cs:ligne 273
   at bedrock.net.XEP124Socket.FakeReceivedStream() in 
D:\\Programs\\Jabber-Net\\src\\bedrock\\net\\XEP124Socket.cs:ligne 455
   at bedrock.net.XEP124Socket.FakeTimer(Object state) in 
D:\\Programs\\Jabber-Net\\src\\bedrock\\net\\XEP124Socket.cs:ligne 287
   at System.Threading._TimerCallback.TimerCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
   at System.Threading._TimerCallback.PerformTimerCallback(Object state)"

Original issue reported on code.google.com by ZiadSall...@gmail.com on 23 May 2009 at 12:24

GoogleCodeExporter commented 9 years ago
I am having a similar recurring problem.

I get the following error occasionally when attached to the debugger:
The one attched to the debugger threw this exception:

  System.NullReferenceException' occurred in jabber-net.dll
  Additional information: Object reference not set to an instance of an object.

Unfortunately, no stack trace or further information.

Interestingly, this error always happens when there is a network problem. For 
example
in this case, it was after I resumed from Windows XP hibernation (and for a 
brief
period after resuming the network isn't quite ready).

However, I've tried to reproduce (disabling network card, pulling out network 
cable
etc), but no joy.

I'm using jabber-net.dll 2.1.0.710.

John Wood

Original comment by jdmw...@gmail.com on 12 Jun 2009 at 9:33

GoogleCodeExporter commented 9 years ago
See also Issue 63

Original comment by jdmw...@gmail.com on 12 Jun 2009 at 10:04

GoogleCodeExporter commented 9 years ago
In head, there are asserts in HTTPStanzaStream.ISocketEventListener.OnRead, but 
it looks like what is happening 
is that OnClose is firing before OnRead.  Can you try putting this line at the 
top of HTTPStanzaStream.ISocketEventListener.OnRead, and seeing if it fixes 
your problem?

            if ((m_listener == null) || (m_elements == null))
                return false;

Original comment by hil...@gmail.com on 12 Jun 2009 at 3:37

GoogleCodeExporter commented 9 years ago
Hi, 

I've applied this fix as described (from head source code). I'm pleased to say I
haven't seen the error at all in about 2 weeks (and that's with a LOT of 
testing). 

Sounds like that fixed it.

John

Original comment by jdmw...@gmail.com on 12 Jul 2009 at 4:34