|Anonymous | Login | Signup for a new account||2019-01-18 17:05 PST|
|Main | My View | View Issues | Change Log | Roadmap | Summary | My Account|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0007345||opensim||[REGION] Script Functions||public||2014-10-08 10:26||2015-06-13 15:00|
|Platform||Intel i7 930 quad core||OS||Windows .NET||OS Version||Win7 x64|
|Product Version||master (dev code)|
|Target Version||Fixed in Version|
|Summary||0007345: Attach event does not trigger correctly on detach|
|Description||Per the LSL Wiki (http://wiki.secondlife.com/wiki/Attach [^])|
"When detached to inventory, an object is only given limited time to execute its attach events. If these events are active when the script derezzes but have not completed, execution will finish when the object is next rezzed."
In my testing with OpenSim 0.8.1 cbd428c 2014-10-04 it would appear that the attach event is *never* processed until the object is next attached, at which point it first executes the detach (presumably stored queued in script state) and then the attach. I have tested this in a completely empty sandbox region with 0 prims, 0 scripts, and only me logged in so the script should have more than enough time to execute the detach at the time it occurs.
|Steps To Reproduce||Rez a prim and put this in it|
llOwnerSay("Processing attach event triggered with key value: "+who);
Pick up and attach the prim. As you'll see, the event will only ever trigger when newly attaching it at which point you'll see it double-processed.
|Tags||No tags attached.|
|Git Revision or version number|
|Run Mode||Standalone (Multiple Regions)|
|Environment||.NET / Windows64|
|Viewer||FS 4.6.7 (42398) OS vers|
|Attached Files||FixDetachEvent_v2.patch [^] (1,584 bytes) 2015-05-25 17:57 [Show Content]|
Mata Hari (reporter)
|I should mention that the reason for marking this a major issue is that it's a problem when scripting something like an AO or other attachment that animates the agent who wears it. When the object is detached ideally you want to have it release animations rather than having to require the user to first turn it off somehow prior to detaching or be forced to use their viewer to revoke permissions and stop them.|
|At this time, the detach event does nothing until reattached. It has been said that this problem can not be fixed with the current architecture of the script engine. This was not an option for me, i need this event to reliably fire when a scripted object is detached. The patch I have added here is not ideal but better than nothing.|
edited on: 2015-05-25 19:43
Can someone please test if a Thread.Yield will do the job? I hate placing hardcoded sleeps in the code. I'm guilty of that too, but it should be the last resort...
Also, the proposed fix seems to be in a generic place. Could this be fixed in LSL_Api DetachWrapper?
llSay(0, "Script running");
if(id == NULL_KEY)
llSay(0, "Detached Object");
llSay(0, "Attached Object");
I have tested with Yield and in most cases this still does not fire the event on detach. I believe this is because the thread only yields to other threads on the same core.
Also placing the sleep anywhere else such as LSL_Api and DetachWrapper, would not work because the pause needs to be after adding the event to the queue but before the script state is stopped. This means it must be right in the middle of the 'PrepareScriptInstanceForSave' method.
An additional note. While testing I added a large sleep time to allow me to check if any noticeable side effects showed up for other avatars in the region. While the avatar that was detaching the item was locked up in this state, another avatar in the region could fly round freely with no lag so I'm pretty sure only the avatar detaching is affected by the extra 2 millisecond delay.
[15:07] <cia-opensim> opensim: alicia * r5e09e52ee99a OpenSim/Region/CoreModules/Avatar/Attachments (AttachmentsModule.cs):
[15:07] <cia-opensim> Attachments Module. Fix detach event not being fired until the next time the object is attached.
[15:07] <cia-opensim> Not an ideal fix but this allows scripts such as AOs to remove animations when detached etc. The pause added does not affect other avatars or the scene in general and only pauses the avatar performing the detach for an extra 2 milliseconds.
|2014-10-08 10:26||Mata Hari||New Issue|
|2014-10-08 10:32||Mata Hari||Note Added: 0026885|
|2015-05-25 16:53||AliciaRaven||File Added: FixDetachEvent.patch|
|2015-05-25 16:53||AliciaRaven||Note Added: 0028445|
|2015-05-25 16:55||AliciaRaven||Status||new => patch included|
|2015-05-25 17:07||AliciaRaven||Relationship added||related to 0006592|
|2015-05-25 17:07||AliciaRaven||Relationship added||related to 0005897|
|2015-05-25 17:57||AliciaRaven||File Added: FixDetachEvent_v2.patch|
|2015-05-25 17:57||AliciaRaven||File Deleted: FixDetachEvent.patch|
|2015-05-25 19:26||Diva||Note Added: 0028446|
|2015-05-25 19:43||AliciaRaven||Note Added: 0028447|
|2015-05-25 19:43||Diva||Note Edited: 0028446||View Revisions|
|2015-05-25 20:51||AliciaRaven||Note Added: 0028448|
|2015-05-26 15:08||Diva||Assigned To||=> Diva|
|2015-05-26 15:08||Diva||Status||patch included => assigned|
|2015-05-26 15:09||Diva||Note Added: 0028452|
|2015-05-26 15:09||Diva||Status||assigned => resolved|
|2015-05-26 15:09||Diva||Resolution||open => fixed|
|2015-06-13 15:00||Diva||Status||resolved => closed|
|Copyright © 2000 - 2012 MantisBT Group|