Random Chitchat 2012-2016
I have analysed the crashdump tonibm9 has provided and the cause is quite simple - a plugin is trying to call cItems:Get() for an item index that is not in the cItems object. Now, I haven't checked the plugin's source yet (I suppose it's the one by STR_Warrior to fix pickups), but I suppose it has an off-by-one error, too - the cItems object is indexed starting at zero, so valid indices are 0 .. (Size() - 1).
I'll fix the cItems interface to be resistant to these kinds of errors - instead of crashing it will log an error and return a nil object. Pity, that's a bit of performance lost (but hey, it's no big deal here, it's not like you'll be calling this 500k times a second.)
Thanks given by:
Or make a safe and unsafe version of the function for it if performance is important.
Thanks given by:
I tried PickupFix with Ubuntu, and it worked!
The error is with CentOS
but please fix it, ubuntu is too slow for me! CentOS is better!
Thanks given by:
Rev 1472 should be working, but it will produce warnings whenever the old version would crash because of the plugin Wink

(05-13-2013, 01:56 AM)FakeTruth Wrote: Or make a safe and unsafe version of the function for it if performance is important.

Nah, here it's really not important, safety is much better here.
Thanks given by:
(05-13-2013, 01:59 AM)xoft Wrote: Rev 1472 should be working, but it will produce warnings whenever the old version would crash because of the plugin Wink
Ok, I will try, but, can you remove warnings?
Thanks given by:
(05-13-2013, 01:58 AM)tonibm19 Wrote: I tried PickupFix with Ubuntu, and it worked!

It might have worked, but it could have also corrupted memory somewhere, which would cause MCServer to crash later on.

(05-13-2013, 02:00 AM)tonibm19 Wrote: [...] can you remove warnings?

I could, but I did put them there on purpose in the first place - it's to warn plugin authors that their plugin is doing something wrong and they should fix it. The problem here isn't with MCServer, but it's the plugin that's to blame. Ask STR to fix it Wink
Thanks given by:
Quote:to avoid server crashes with badly written
plugins.
well i did write it in 3-7 minutes Wink

this is the code i used:
function Initialize(Plugin)
	PLUGIN = Plugin
	Plugin:SetName("PickupFix")
	Plugin:SetVersion(1)
	
	PluginManager = cRoot:Get():GetPluginManager()
	cPluginManager:Get():AddHook(Plugin, cPluginManager.HOOK_BLOCK_TO_PICKUPS)

	LOGINFO("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
	return true
end

function OnBlockToPickups(World, Digger, BlockX, BlockY, BlockZ, BlockType, BlockMeta, Pickups)
	Item = Pickups:Get( 0 )
	Pickups:Clear()
	local Pickup = cItems();
	Pickup:Add( Item )
	World:SpawnItemPickups( Pickup, BlockX, BlockY, BlockZ, 0, 0, 0 )
end
Thanks given by:
Can you send the plugin to me? I'd like to see how it fixes the pickups and maybe fix int in the server itself, so that there's no need for a plugin.
Thanks given by:
(05-13-2013, 02:10 AM)xoft Wrote: Can you send the plugin to me? I'd like to see how it fixes the pickups and maybe fix int in the server itself, so that there's no need for a plugin.

https://forum.cuberite.org/attachment.php?aid=282
but what it does is that it calls OnBlockToPickups, it gets all the items from the Pickups object, then clears it and then spawns the item using cWorld::SpawnItemPickups.
Thanks given by:
So effectively all it does is reset the velocity parameters to zero. I'll try putting that in the server directly.

Btw, you could have just used this, does the same thing, even better (in case there are 2 or more kinds of pickups):
function OnBlockToPickups(World, Digger, BlockX, BlockY, BlockZ, BlockType, BlockMeta, Pickups)
	World:SpawnItemPickups(Pickups, BlockX, BlockY, BlockZ, 0, 0, 0);
	Pickups:Clear();
end
Thanks given by:




Users browsing this thread: 27 Guest(s)