View Issue Details

IDProjectCategoryView StatusLast Update
0001624Multi Theft Auto : San AndreasScriptingpublic2007-11-14 20:52
Reportererorr404Assigned ToeAi 
PriorityhighSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Versionblue_sa.r2.a12 
Target VersionFixed in Versionmtasadm_v1.0-dp1 
Summary0001624: removeEventHandler related server crash
Description

The function below crashed the server. I can't figure out what line caused it since the server is down.

A guess would be removing an event handler inside the function itself: removeEventHandler ( "onMarkerHit", source, "onFlagHit" )

Steps To Reproduce

/start handlercrash
Send a chat message.

Additional Information

function crasherHandler()
removeEventHandler ( "onPlayerChat", getRootElement(), crasherHandler )
setElementData ( source, "test", 2 )
end
addEventHandler ( "onPlayerChat", getRootElement(), crasherHandler )

TagsNo tags attached.

Relationships

has duplicate 0002366 closed call function crashes server 

Activities

slothman

2007-09-05 16:54

updater   ~~0005625

Last edited: 2007-09-05 17:28

Im having this issue as well, heres what its doing:

then you remove the eventhadler in a function that is triggered by that eventhandler, it inturrupts the function and crashes the server. this is still going on.

EDIT: moving the removeeventhandler to the bottom of the function seems to resolve this, but its still a bad thing to leave in here if it crashes the server.

Jax

2007-09-07 04:41

administrator   ~~0005641

Can we get a better script for this too?

Slinky

2007-09-07 06:01

reporter   ~~0005644

Maybe its your use of the arguments, your event handling lines should read:
removeEventHandler("onMarkerHit",source,onFlagHit)
addEventHandler("onPlayerWasted",player,onTargetWasted)

it takes functions not strings (at least last time i checked)

slothman

2007-09-07 15:06

updater   ~~0005649

the reason its wrong in errors example is cause thats how it used to be back when error submitted this report (before your time smoo)

jbeta

2007-09-18 20:41

updater   ~~0005751

Can't reproduce just by doing:

function crasherhandler()
removeEventHandler("onPlayerChat",getRootElement(),crasherhandler)
outputChatBox("Handler removed.")
end
addEventHandler("onPlayerChat",getRootElement(),crasherhandler)

When it triggers, the text is output and the server doesn't crash.

I have a feeling it may have to do with one of the operations you're doing after removing it, will test thorougly tomorrow.

jbeta

2007-09-19 18:02

updater   ~~0005760

The following script ('handlercrash' resource on test servers) crashes the server right after you send a chat message:

function crasherHandler()
removeEventHandler ( "onPlayerChat", getRootElement(), crasherHandler )
setElementData ( source, "test", 2 )
end
addEventHandler ( "onPlayerChat", getRootElement(), crasherHandler )

Tried clientside as well, but couldn't reproduce it.

jbeta

2007-09-19 18:14

updater   ~~0005761

#1624 seems to be the same issue. In both scripts, you're calling a function that will trigger an event from inside a handler that's just been removed.

eAi

2007-11-14 20:52

administrator   ~~0006279

Fixed. Please check that it can't be produced on the client too.

Issue History

Date Modified Username Field Change