cPluginManager:GetLuaPlugin() and lua_State
#15
xoft, do you think if all plugins would share the same critical section a deadlock can still happen when one plugin calls a function on another plugin?

Take these two plugins
PluginChat: Hooks into the player chat
PluginPermissions: Can be used to check player permissions and does weird stuff

Handle packet thread
1. OnChat -- Lock plugin criticalsection
2. PluginChat:OnChat
3. Call PluginPermissions:CanChat()
4. PluginPermissions:CanChat() decides to loop over all entities/players to find out whether the player is allowed to chat ( ???Tongue )
5. Waiting for Entity list lock (Tick thread owns this lock)

Tick thread
1. cPlayer:Tick() (player takes damage from hunger) -- Entity list/critical section is locked
2. OnTakeDamage
3. Waiting for critical section on plugins (Handle packet thread owns this)


And voila, deadlock.
EDIT: Man, this could even happen if it was a single plugin... which means this deadlock is in MCServer RIGHT NOW
Reply
Thanks given by:


Messages In This Thread
RE: cPluginManager:GetLuaPlugin() and lua_State - by FakeTruth - 09-26-2012, 04:25 AM



Users browsing this thread: 2 Guest(s)