Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Invalid id under OnDynamicObjectMoved/OnPlayerEnterDynamicArea with Streamer_GetIntData #98

Closed
IstuntmanI opened this issue Feb 12, 2016 · 5 comments

Comments

@IstuntmanI
Copy link
Contributor

IstuntmanI commented Feb 12, 2016

Why I receive that error under those callbacks ? I mean, if I use the objectid/areaid as the id on Streamer_GetIntData, it should definitely exists in those callbacks, because an invalid object can't finish it's movement, because it doesn't exists, and you can't enter an invalid area. To fix this I have to use IsValidDynamicObject/Area. I don't know when this happens, it happens pretty randomly. Can anyone confirm this and specify when exactly this happens ?

[12/02/2016 20:18:44] [debug] AMX backtrace:
[12/02/2016 20:18:44] [debug] #0 native PrintAmxBacktrace () from crashdetect.so
[12/02/2016 20:18:44] [debug] #1 0027e14c in public Streamer_OnPluginError (4571960) from GM.amx
[12/02/2016 20:18:44] [debug] #2 native Streamer_GetIntData () from streamer.so
[12/02/2016 20:18:44] [debug] #3 0028dd38 in public OnDynamicObjectMoved (124965) from GM.amx

[13/02/2016 00:31:28] [debug] AMX backtrace:
[13/02/2016 00:31:28] [debug] #0 native PrintAmxBacktrace () from crashdetect.so
[13/02/2016 00:31:28] [debug] #1 0027e14c in public Streamer_OnPluginError (4571960) from GM.amx
[13/02/2016 00:31:28] [debug] #2 native Streamer_GetIntData () from streamer.so
[13/02/2016 00:31:28] [debug] #3 001e87fc in public OnPlayerEnterDynamicArea (6, 154) from GM.amx

(no debug mode, but it doesn't matter, it's how I described them)

@samp-incognito
Copy link
Owner

The only reason you'd get that message is if the object or area just doesn't exist. I'd try paying attention to which IDs are causing the problem and seeing if there's any kind of pattern behind it.

@IstuntmanI
Copy link
Contributor Author

I know that the reason of those errors is that they don't exist. But this shouldn't happen in those callbacks, as those IDs have to be valid for the callbacks to be called. I have lots of movable objects and areas. I don't know how to reproduce it, I asked maybe if someone else has/had this problem. Those callbacks shouldn't be called at all if those IDs are actually invalid.

@samp-incognito
Copy link
Owner

Perhaps you're destroying objects and/or areas that are referenced almost immediately afterwards in those callbacks.

Actually, looking at the code again, I don't even see any validity checks for the objects or areas before those callbacks are executed, so that does seem to be the problem. I'll fix this soon.

@IstuntmanI
Copy link
Contributor Author

No, I don't. I checked where I remove the object/area under those callbacks, but I saw that immediately after I delete them I return 1, so it won't continue to the rest of the callback for that id.

Even if there aren't sanity checks, that still shouldn't happen, it's weird that it happens to invalid IDs.

@samp-incognito
Copy link
Owner

No, I mean you could destroy an object or area under one of those callbacks, and then the same callback could be called again for an ID that no longer exists because you had just destroyed it earlier.

The callbacks in the plugin aren't executed immediately after an object is moved or a player enters or leaves an area. (What if the script decides to destroy objects or areas under a callback in the middle of the streaming process? That would invalidate iterators and cause a crash.) Instead, all of the information is placed in a few dynamic arrays and processed at the end of each update. Unfortunately, there aren't any sanity checks in place to ensure that the IDs still actually exist before the callbacks are executed, which is probably why you're seeing these error messages.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants