azerothcore/mod-eluna

Player Hook 45 - Achievement seem to cause segfault often, but not always

Closed this issue · 7 comments

Commit: bad5bb7

I am encountering segvaults when hooking player event 45 to trigger an HTTP request.

It's no 100%, but 90% of the time when an achievement is triggered the server dies which is very unfortunate because loot gets lost on any major dungeon achievement. Unhooking removes the crash.

Didn't get a chance to debug build and investigate yet.

local function OnPlayerAchievementComplete (event, player, achievement)
  if (achievement ~= nil and achievement:GetId() ~= 0) then
   
  // HttpRequest(....)

  end
end

RegisterPlayerEvent(45, OnPlayerAchievementComplete)

Hi georgzoeller,
thanks for the report. Any further clarification would be appreciated. Does the segfault happen in the event regardless of what's executed? Or only for a HTTP request?

Debugging it would be ace, thanks!

Spent some more time testing by using .achievement add

  • Doesn't happen with hook is not hooked
  • Doesn't happen on an empty hook
  • Does happen about 3/5 times when hook contains a http request
  • Does not seem to happen on http requests in other hooks as far as I can tell - I hooked a large number of events and sent http requests from them but the only time I got the segvault is from the achievement hook.
  • The only achievement specific function I'm using is achievement:GetId() consuming the achievement arg passed into the hook.

not much info from the logs

/azerothcore/apps/startup-scripts/simple-restarter: line 70: 165 Segmentation fault "./$bin_file"
exit code: 139

Thanks for the followup! Feel free to add any further input.
A crashlog would simplify tracking it.

Any news on this @georgzoeller ?
Did it happen again? Can you provide a crashlog?

It's also happend on latest AzerothCore.
commit rev: azerothcore/azerothcore-wotlk@bd7f139

Encounter segvaults when hooking player event 45 to trigger an HTTP request.

To be able to look into it, we need to reproduce it. Please provide the revisions of AC, mod-Eluna and the script with reproduction steps.

AC:azerothcore/azerothcore-wotlk@bd7f139
mod-Eluna:53514a2

reproduce:

local function OnPlayerAchievementComplete (event, player, achievement)
  if (achievement ~= nil and achievement:GetId() ~= 0) then
   
  // HttpRequest(....)

  end
end

RegisterPlayerEvent(45, OnPlayerAchievementComplete)

.achievement add in game and trigger this hook. It will be reproduced in 10 times.