tldr; I think I may have caused a problem with lnet by training in a spell and then untraining it (and having no spells after untraining). How do I fix it?

Everything with lich has been running great, until today. This morning lich crashed, and after I exited and restarted I started seeing almost 50% cpu usage from rubyw.exe.

After killing off all of the scripts it settled back down to .15 ~ 2 percent. I started running scripts again I narrowed down the issue to lnet. When I kill it, everything works fine, when I run it everything crawls and cpu spikes and holds above 45%.

I tried downloading a fresh copy of lnet from the repo, but still have the same issue. Tried rebooting, checking that antivirus wasn't messing with ruby both without any luck.



After checking out the debug log and scripts, I think I may have caused this issue by training in a spell and then untraining it.

This is the debug log I get whenever starting up and connecting lich:

Code:
2017-11-23 10:02:37: info: Lich 4.6.42
2017-11-23 10:02:37: info: Ruby 2.0.0
2017-11-23 10:02:37: info: i386-mingw32
2017-11-23 10:02:37: info: no force-mode info given
2017-11-23 10:02:52: info: gamehost: storm.gs4.game.play.net
2017-11-23 10:02:52: info: gameport: 10024
2017-11-23 10:02:52: info: game: STORM
2017-11-23 10:02:52: info: launcher_cmd: Win32.ShellExecute(:lpOperation => "open", :lpFile => "C:\\Users\\Xanlin\\AppData\\Roaming\\lich\\temp\\lich3339.sal", :lpDirectory => "C:\\Users\\Xanlin\\AppData\\Roaming\\lich\\temp")
2017-11-23 10:02:52: info: waiting for client to connect...
2017-11-23 10:02:53: info: connected
2017-11-23 10:02:53: info: connecting to game server (storm.gs4.game.play.net:10024)
2017-11-23 10:02:53: info: connected
2017-11-23 10:02:56: error: SpellRanks.load: marshal data too short
	C:/Users/Xanlin/AppData/Roaming/lich/lich.rbw:6953:in `load'
	C:/Users/Xanlin/AppData/Roaming/lich/lich.rbw:6953:in `block in load'
	C:/Users/Xanlin/AppData/Roaming/lich/lich.rbw:6952:in `open'
	C:/Users/Xanlin/AppData/Roaming/lich/lich.rbw:6952:in `load'
	C:/Users/Xanlin/AppData/Roaming/lich/lich.rbw:6989:in `timestamp'
	lnet:1180:in `block (2 levels) in _script'
	lnet:1176:in `loop'
	lnet:1176:in `block in _script'
lnet.lic code for lines in debug:

Code:
Line 1172: #
Line 1173: # connect and listen to the server
Line 1174: #
Line 1175: Thread.new {
Line 1176: 	loop {
Line 1177: 		last_connect_attempt = Time.now
Line 1178: 		begin
Line 1179: 			LNet.connect
Line 1180: 			LNet.send_request(attr={'type'=>'spell-ranks', 'to'=>'server', 'timestamp'=>SpellRanks.timestamp.to_s}) if defined?(SpellRanks)
Line 1181: 			REXML::Document.parse_stream(LNet.server, LNet.new)
Line 1182: 		rescue
Line 1183: 			echo $!
Line 1184: 			respond $!.backtrace[0..1]
Line 1185: 		end
Line 1186: 		LNet.server.close rescue()
Line 1187: 		if LNet.server_restart
Line 1188: 			LNet.server_restart = false
Line 1189: 			echo 'server is restarting; waiting 30 seconds to reconnect...'
Line 1190: 			sleep 30
Line 1191: 		else
Line 1192: 			echo 'connection lost'
Line 1193: 			wait_time = [300 - (Time.now - last_connect_attempt), 1].max
Line 1194: 			if wait_time > 1
Line 1195: 				echo "waiting #{wait_time.to_i} seconds before trying to reconnect..."
Line 1196: 			end
Line 1197: 			sleep wait_time
Line 1198: 		end
Line 1199: 	}
Line 1200: }
lich code:
Code:
Line 6940: class SpellRanks
Line 6941: 	@@list      ||= Array.new
Line 6942: 	@@timestamp ||= 0
Line 6943: 	@@loaded    ||= false
Line 6944: 	@@elevated_load = proc { SpellRanks.load }
Line 6945: 	@@elevated_save = proc { SpellRanks.save }
Line 6946: 	attr_reader :name
Line 6947: 	attr_accessor :minorspiritual, :majorspiritual, :cleric, :minorelemental, :majorelemental, :minormental, :ranger, :sorcerer, :wizard, :bard, :empath, :paladin, :arcanesymbols, :magicitemuse, :monk
Line 6948: 	def SpellRanks.load
Line 6949: 		if $SAFE == 0
Line 6950: 			if File.exists?("#{DATA_DIR}/#{XMLData.game}/spell-ranks.dat")
Line 6951: 				begin
Line 6952: 					File.open("#{DATA_DIR}/#{XMLData.game}/spell-ranks.dat", 'rb') { |f|
Line 6953: 						@@timestamp, @@list = Marshal.load(f.read)
Line 6954: 					}
Line 6955: 					# minor mental circle added 2012-07-18; old data files will have @minormental as nil
Line 6956: 					@@list.each { |rank_info| rank_info.minormental ||= 0 }
Line 6957: 					# monk circle added 2013-01-15; old data files will have @minormental as nil
Line 6958: 					@@list.each { |rank_info| rank_info.monk ||= 0 }
Line 6959: 					@@loaded = true
Line 6960: 				rescue
Line 6961: 					respond "--- Lich: error: SpellRanks.load: #{$!}"
Line 6962: 					Lich.log "error: SpellRanks.load: #{$!}\n\t#{$!.backtrace.join("\n\t")}"
Line 6963: 					@@list      = Array.new
Line 6964: 					@@timestamp = 0
Line 6965: 					@@loaded = true
Line 6966: 				end
Line 6967: 			else
Line 6968: 				@@loaded = true
Line 6969: 			end
Line 6970: 		else
Line 6971: 			@@elevated_load.call
Line 6972: 		end
Line 6973: 	end
Line 6974: 	def SpellRanks.save