Server freeze on plugin loading
#1
Hey all, i've recently become more interested in MCServer and decided to mess around with Lua and make a basic plugin. I've followed the plugin tutorial and looked at the Core plugin on github but i'm not necessarily sure what the issue causing the server to freeze on startup would be. I have the debug plugin enabled but it doesn't seem to log anything as the server freezes right when loading my plugin. (I have named the file plugin.lua) Code is below if anyone could give me a hand, thanks.

function Initialize(Plugin)
	plugin:setName("Basics")
	plugin:setVersion(1)
	
	PluginManager = cRoot:Get():GetPluginManager()
	
	LOG("Loading " .. Plugin:GetName() .. "Version: " .. Plugin:GetVersion())
	
	cPluginManager.BindCommand(\'/heal\', \'Basics.heal\', HealPlayer, \' Heal player to full health.\')
	return true 
end

function HealPlayer(Split, Player)
local Healed = false
	if (Split[2] == nil) then
		SendMessage(Player, cChatColor.Red .. \'You have been healed.\')
		Player:Feed(20)
		Player:Heal(20)
		Healed = true
		return true
	end
end
	
  if not(Healed) then
	SendMessageFailure(Player, Split[2] .. \'was not found.\')
	return false
end
		
		
EDIT: I'm not sure why the code tags added the extra /'s.. but the code is also on pastebin here: http://pastebin.com/R1sGhyrM

EDIT 2: It seems that the ZeroBrane debugger isn't functioning correctly, will report back if i figure out a solution
Reply
Thanks given by:
#2
I guess this issue could be considered closed for now, the issue seems to be with the zerobrane debugging.
Reply
Thanks given by:
#3
I'm working on ZeroBrane integration, so I'd like to hear some more about this. So you've found out that running the server under ZBS causes the freezes on startup? Would you mind doing a few experiments for me?

I suppose you've followed the ZBS setup guide, http://mc-server.xoft.cz/LuaAPI/SettingUpZeroBrane.html . You should know then about the mcserver.lua file, the ZBS plugin in the "packages" folder. Open that file in an editor and locate the following code (should be on line 55):
-- Create the @EnableMobDebug.lua file so that the MCS plugin starts the debugging session, when loaded:
local EnablerPath = wx.wxFileName(wfilename)
EnablerPath:SetName("@EnableMobDebug")
EnablerPath:SetExt("lua")
local f = io.open(EnablerPath:GetFullPath(), "w")
if (f ~= nil) then
	f:write([[require("mobdebug").start()]])
	f:close()
end

Comment out the line "f:write([[require("mobdebug").start()]])" in it, save and restart ZBS. Does the server still experience the startup freeze? I would expect not; but then, debugging is not working in the plugin. Is that so?
Reply
Thanks given by:
#4
(04-04-2014, 03:03 PM)xoft Wrote: I'm working on ZeroBrane integration, so I'd like to hear some more about this. So you've found out that running the server under ZBS causes the freezes on startup? Would you mind doing a few experiments for me?

I suppose you've followed the ZBS setup guide, http://mc-server.xoft.cz/LuaAPI/SettingUpZeroBrane.html . You should know then about the mcserver.lua file, the ZBS plugin in the "packages" folder. Open that file in an editor and locate the following code (should be on line 55):
-- Create the @EnableMobDebug.lua file so that the MCS plugin starts the debugging session, when loaded:
local EnablerPath = wx.wxFileName(wfilename)
EnablerPath:SetName("@EnableMobDebug")
EnablerPath:SetExt("lua")
local f = io.open(EnablerPath:GetFullPath(), "w")
if (f ~= nil) then
	f:write([[require("mobdebug").start()]])
	f:close()
end

Comment out the line "f:write([[require("mobdebug").start()]])" in it, save and restart ZBS. Does the server still experience the startup freeze? I would expect not; but then, debugging is not working in the plugin. Is that so?

You seem to be correct about that, i commented out that line and the server seems to startup fine.
Reply
Thanks given by:
#5
Okay, is there anything special about the network setup on the machine you're testing this on? Perhaps something in the name resolution, failing to resolve localhost, or just taking long? I'm expecting this to be the cause. I'm inviting Paul, the author of ZBS, over to this thread, he might have further ideas about this. We want to make this work, after all.
Reply
Thanks given by:
#6
(04-05-2014, 06:08 AM)xoft Wrote: Okay, is there anything special about the network setup on the machine you're testing this on? Perhaps something in the name resolution, failing to resolve localhost, or just taking long? I'm expecting this to be the cause. I'm inviting Paul, the author of ZBS, over to this thread, he might have further ideas about this. We want to make this work, after all.

@gv1222, are you running on OSX by any chance? I may have an idea about what may be going on. I've been working on this ticket for MobDebug (https://github.com/pkulchenko/MobDebug/issues/12) and it could be related to the issue you see. Could you try with an earlier version of MobDebug (for example, 0.5511 or earlier) to see if the issue goes away?

If that's the case, I'm working on a fix that should be available in a day or two. Thank you. Paul.
Reply
Thanks given by:
#7
xoft,

I have tested running the debugger on two different networks (School & Home) and neither seem to make a different though i'm not sure that would change anything) Running mcserver.exe also runs fine when not using the debugger so i couldn't imagine it's network related.

Image of server debugger starting: http://puu.sh/7Wgcl/59d5225587.png - Freezes when loading plugin "Basic" (Currently the plugin i am working on)
Imagine of running mcserver independently: http://puu.sh/7WgtX/3868b645f7.png (Using the same files as the debugger, finishes setup)

Paul,
I'm currently running Win8 and will test out using an earlier version and report back.
Thanks

Edit: I went through versions of MobDebug and have narrowed down the issue between version .52 and .53 (Won't launch on .53). Hopefully that helps.
Reply
Thanks given by:
#8
(04-05-2014, 10:20 AM)gv1222 Wrote: I'm currently running Win8 and will test out using an earlier version and report back.

Edit: I went through versions of MobDebug and have narrowed down the issue between version .52 and .53 (Won't launch on .53). Hopefully that helps.

That's very interesting and not quite what I expected. I don't have win8 handy, but will try to get access to it, although I'm not sure how I can reproduce the same configuration as it's a company laptop, so I probably won't be able to install MC server there Wink.

Is there any chance you can bisect the issue to a particular commit between .52 and .53? The only thing that could be relevant is "Replaced socket.select with non-blocking .receive as it is faster.", but I'm not sure what it would cause the issue you see.

Also, it would be helpful to turn verbose debugging on in ZBS (you can add "debugging.verbose = true" to the user.lua config file) as it would report all debugging commands to the output window, which may help to figure out where it blocks. So far that's the only instance where it's been reported, so I'd be interested to find what may be causing this. Thank you for your help!
Reply
Thanks given by:
#9

Alright.. earlier today i had access to my second computer and tested out ZeroBrane on and it seemed to be fine with the latest version of MobDebug so i would assume that the issue is somehow related to the computer individually, unsure what the exact issue is yet, if I do manage to figure it out i'll make sure to post back.

Update: After posting this i noticed something strange, on the computer that the debugger is not functioning correctly, the zerobrane window with flash as if it is asking for admin rights, etc. Unsure why this is happening as both computers have the "same" setup.
Reply
Thanks given by:
#10
Couldn't it be that the flashing ZBS is actually in a breakpoint and waiting for you to continue execution? It would happen if you changed the debugger.runonstart value (or didn't change, I've forgotten which way Wink
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)