Open GoogleCodeExporter opened 9 years ago
Oh and this is visual studio 2005 and windows xp pro sp 3
Original comment by michel.y...@vtxmail.ch
on 1 May 2009 at 8:02
When OnError, the first exception is thrown in
SocketStanzaStream:ISocketEventListener.OnRead(BaseSocket, byte[], int, int)
by m_element.Push(buf, offset, length);
Exception text: Unexpected exception. InnerException text: object reference not
set
to an instance of an object.
The exception stack trace is:
at jabber.protocol.AsynchElementStream.Push(Byte[] buf, Int32 offset, Int32
length)
at
jabber.connection.SocketStanzaStream.bedrock.net.ISocketEventListener.OnRead(Bas
eSock
et sock, Byte[] buf, Int32 offset, Int32 length)
The OnError call stack is
JabberPort.dll!JabberPort.JabberPort.client_OnError(object sender =
{jabber.client.JabberClient}, System.Exception ex = {"Unexpected exception"})
Line
213 C#
jabber-
net.dll!jabber.connection.XmppStream.jabber.connection.IStanzaEventListener.Erro
red(S
ystem.Exception ex = {"Unexpected exception"}) Line 1670 + 0x16 bytes C#
jabber-
net.dll!jabber.connection.SocketStanzaStream.bedrock.net.ISocketEventListener.On
Error
(bedrock.net.BaseSocket sock = {AsyncSocket
172.24.1.74:1956->172.24.1.74:5222},
System.Exception ex = {"Unexpected exception"}) Line 414 + 0xc bytes C#
> jabber-
net.dll!jabber.connection.SocketStanzaStream.bedrock.net.ISocketEventListener.On
Read(
bedrock.net.BaseSocket sock = {AsyncSocket 172.24.1.74:1956->172.24.1.74:5222},
byte[] buf = {Dimensions:[4096]}, int offset = 0, int length = 319) Line 430 +
0xf
bytes C#
jabber-net.dll!bedrock.net.AsyncSocket.GotData(System.IAsyncResult ar =
{System.Net.BufferAsyncResult}) Line 957 + 0x1c bytes C#
[External Code]
Original comment by michel.y...@vtxmail.ch
on 1 May 2009 at 11:34
I found out that jabber.protocol.EnumParser::GetValHash (and GetStringHash) are
not
threadsafe. However I could observe two threads running simultaneously in this
method.
Static member variable s_strings and s_vals must use a synchronization scheme.
From MSDN:
"A Dictionary<TKey, TValue> can support multiple readers concurrently, as long
as the
collection is not modified. Even so, enumerating through a collection is
intrinsically not a thread-safe procedure. In the rare case where an
enumeration
contends with write accesses, the collection must be locked during the entire
enumeration. To allow the collection to be accessed by multiple threads for
reading
and writing, you must implement your own synchronization."
A synchronization scheme that allows concurrent read access and exclusive write
access would be more efficient than RW-exclusive since write's occur rarely.
Therefore I suggest to not use the "lock" statement.
Original comment by michel.y...@vtxmail.ch
on 5 May 2009 at 1:57
has this issue been fixed?
cause in my architecture i use multiple clients from one machine and this seems
to give random errors/disconnects.
Original comment by wgtm.pet...@gmail.com
on 16 Nov 2010 at 9:11
To fix this at home yourself do the following in EnumParser.cs:
Add a synchronization object:
private static readonly g_sync = null;
Add a synchronization block to GetValHash() and GetStringHash() (top of method
should look like this):
Dictionary<string, object> map = null;
if (!s_vals.TryGetValue(t, out map))
{
lock (g_sync)
{
if (s_vals.ContainsKey(t))
return s_vals[t];
s_vals[t] = map = new Dictionary<string, object>();
// Everything else is the same here
// etc
} // End of lock(g_sync)
}
return map;
You'll do something similar in GetStringHash.
Original comment by crwe...@gmail.com
on 17 May 2011 at 1:09
Ahh, I guess I could have just attached the file...
Original comment by crwe...@gmail.com
on 17 May 2011 at 1:11
Attachments:
Original issue reported on code.google.com by
michel.y...@vtxmail.ch
on 1 May 2009 at 7:53Attachments: