meebey / SmartIrc4net

IRC C# Library
http://www.meebey.net/projects/smartirc4net/
Other
127 stars 52 forks source link

Key duplication on join event #19

Closed xPaw closed 7 years ago

xPaw commented 10 years ago

I'm using a bouncer that automatically joins channels, and whenever it reconnects to the IRC server, smartirc4net crashes.

System.ArgumentException: Key duplication when adding: #channelname
  at System.Collections.Hashtable.PutImpl (System.Object key, System.Object value, Boolean overwrite) [0x00000] in <filename unknown>:0
  at System.Collections.Hashtable.Add (System.Object key, System.Object value) [0x00000] in <filename unknown>:0
  at System.Collections.Hashtable+SyncHashtable.Add (System.Object key, System.Object value) [0x00000] in <filename unknown>:0
  at Meebey.SmartIrc4net.IrcClient._Event_JOIN (Meebey.SmartIrc4net.IrcMessageData ircdata) [0x00000] in <filename unknown>:0
  at Meebey.SmartIrc4net.IrcClient._HandleEvents (Meebey.SmartIrc4net.IrcMessageData ircdata) [0x00000] in <filename unknown>:0
  at Meebey.SmartIrc4net.IrcClient._Worker (System.Object sender, Meebey.SmartIrc4net.ReadLineEventArgs e) [0x00000] in <filename unknown>:0
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ReadLineEventArgs (object,Meebey.SmartIrc4net.ReadLineEventArgs)
  at Meebey.SmartIrc4net.IrcConnection.ReadLine (Boolean blocking) [0x00000] in <filename unknown>:0
  at Meebey.SmartIrc4net.IrcConnection.Listen (Boolean blocking) [0x00000] in <filename unknown>:0
  at Meebey.SmartIrc4net.IrcConnection.Listen () [0x00000] in <filename unknown>:0
a-chaudhari commented 10 years ago

I believe I have hit this issue as well. Although it's a little different.

I also use a bouncer and I have active chan sync on. If that matters.

 Thursday, July 31, 2014 1:36:10 PM
System.ArgumentException: Item has already been added. Key in dictionary: '#channel'  Key being added: '#channel'
   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at System.Collections.Hashtable.SyncHashtable.Add(Object key, Object value)
   at Meebey.SmartIrc4net.IrcClient._Event_JOIN(IrcMessageData ircdata) in c:\Users\User\Documents\Visual Studio 2013\remoteLibrary\SmartIrc4net\src\IrcClient\IrcClient.cs:line 2171
   at Meebey.SmartIrc4net.IrcClient._HandleEvents(IrcMessageData ircdata) in c:\Users\User\Documents\Visual Studio 2013\remoteLibrary\SmartIrc4net\src\IrcClient\IrcClient.cs:line 1471
   at Meebey.SmartIrc4net.IrcClient._Worker(Object sender, ReadLineEventArgs e) in c:\Users\User\Documents\Visual Studio 2013\remoteLibrary\SmartIrc4net\src\IrcClient\IrcClient.cs:line 1169
   at Meebey.SmartIrc4net.ReadLineEventHandler.Invoke(Object sender, ReadLineEventArgs e)
   at Meebey.SmartIrc4net.IrcConnection.ReadLine(Boolean blocking) in c:\Users\User\Documents\Visual Studio 2013\remoteLibrary\SmartIrc4net\src\IrcConnection\IrcConnection.cs:line 902
   at Meebey.SmartIrc4net.IrcConnection.Listen(Boolean blocking) in c:\Users\User\Documents\Visual Studio 2013\remoteLibrary\SmartIrc4net\src\IrcConnection\IrcConnection.cs:line 841
   at Meebey.SmartIrc4net.IrcConnection.Listen() in c:\Users\User\Documents\Visual Studio 2013\remoteLibrary\SmartIrc4net\src\IrcConnection\IrcConnection.cs:line 855
   at myIRCProgram.IrcLink.listen() in c:\Users\User\Documents\Visual Studio 2013\Projects\myIRCProgram\myIRCProgram\IrcLink.cs:line 225
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
xPaw commented 10 years ago

@meebey can we get a fix for this please?

meebey commented 10 years ago

I don't have this issue in Smuxi. Probably because Smuxi is not using channel sync or auto rejoin.

meebey commented 9 years ago

One would need the raw IRC message to identify and fix the issue. I suspect the IRC server (or bouncer) is providing some duplicate nick that SmartIrc4net fails on.

meebey commented 7 years ago

From the stack trace with the line number this line seems to throw the exception:

_Channels.Add(channelname, channel);

So either the IRCd sends a duplicate JOIN message for the same channel or the cleaning up didn't work correctly (like after a reconnect).