{"action":"created","issue":{"url":"https://api.github.com/repos/urho3d/Urho3D/issues/1613","repository_url":"https://api.github.com/repos/urho3d/Urho3D","labels_url":"https://api.github.com/repos/urho3d/Urho3D/issues/1613/labels{/name}","comments_url":"https://api.github.com/repos/urho3d/Urho3D/issues/1613/comments","events_url":"https://api.github.com/repos/urho3d/Urho3D/issues/1613/events","html_url":"https://github.com/urho3d/Urho3D/issues/1613","id":178954489,"number":1613,"title":"Strange crash with array access","user":{"login":"slapin","id":6099,"avatar_url":"https://avatars.githubusercontent.com/u/6099?v=3","gravatar_id":"","url":"https://api.github.com/users/slapin","html_url":"https://github.com/slapin","followers_url":"https://api.github.com/users/slapin/followers","following_url":"https://api.github.com/users/slapin/following{/other_user}","gists_url":"https://api.github.com/users/slapin/gists{/gist_id}","starred_url":"https://api.github.com/users/slapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slapin/subscriptions","organizations_url":"https://api.github.com/users/slapin/orgs","repos_url":"https://api.github.com/users/slapin/repos","events_url":"https://api.github.com/users/slapin/events{/privacy}","received_events_url":"https://api.github.com/users/slapin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-23T19:22:01Z","updated_at":"2016-09-23T19:29:56Z","closed_at":null,"body":"This error happens during accesses to arrays of some script objects.\r\nThe code looks innocent (I don't do anything majical).\r\nI just add objects to arrays then parse these arrays, and\r\nafter some iterations this happens. The code is quite complex to use as example,\r\nbut I could not make minimal example.\r\n\r\nSo basic construction which fails is this (code part):\r\n```\r\nclass DataListItem {\r\n     float left, top, right, bottom;\r\n...\r\n}\r\n\r\nclass DataList {\r\n    Array<DataListItem> queue;\r\n    void add(DataListItem d)\r\n    {\r\n        queue.Push(d);\r\n    }\r\n   void fetch()\r\n   {\r\n        DataListItem item = queue[0];\r\n        item.Erase(0);\r\n        return item;\r\n   }\r\n...\r\n\r\n    void process_queue()\r\n    {\r\n        while(!queue.empty) {\r\n            DataListItem item = fetch();\r\n            /* grow function splits rectangles in item */\r\n            Array<DataListItem> res = grow(item);\r\n            if (res.empty) {\r\n               ...\r\n            } else {\r\n               for (int i; i < res.length; i++)\r\n                   add(res[i]);\r\n        }\r\n    }\r\n}\r\n...\r\n\r\nNot all data sets lead to this problem. Neither data used here use Urho objects,\r\nonly primitive types. I guess depends on array sizes but I don't really know,\r\narrays never grow more than 1000 items. First few iteration of process_queue always succeed,\r\nthen problem starts. The processing happens on new instance of object every time.\r\n\r\nUrho3DPlayer: /home/slapin/Urho3D/Source/Urho3D/Container/RefCounted.cpp:62: void Urho3D::RefCounted::ReleaseRef(): Assertion `refCount_->refs_ > 0' failed.\r\n\r\nProgram received signal SIGABRT, Aborted.\r\n0x00007ffff68761c8 in raise () from /lib/x86_64-linux-gnu/libc.so.6\r\n(gdb) bt\r\n#0  0x00007ffff68761c8 in raise () from /lib/x86_64-linux-gnu/libc.so.6\r\n#1  0x00007ffff687764a in abort () from /lib/x86_64-linux-gnu/libc.so.6\r\n#2  0x00007ffff686f107 in __assert_fail_base () from /lib/x86_64-linux-gnu/libc.so.6\r\n#3  0x00007ffff686f1b2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6\r\n#4  0x0000000000aa62cb in Urho3D::RefCounted::ReleaseRef (this=0x2d7e980) at /home/slapin/Urho3D/Source/Urho3D/Container/RefCounted.cpp:62\r\n#5  0x0000000000df489a in asCScriptEngine::CallObjectMethod (this=0x21f13d0, obj=0x2d7e980, i=0x233e740, s=0x233e7c0) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptengine.cpp:3998\r\n#6  0x0000000000df4777 in asCScriptEngine::CallObjectMethod (this=0x21f13d0, obj=0x2d7e980, func=2117) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptengine.cpp:3970\r\n#7  0x0000000000df72f4 in asCScriptEngine::ReleaseScriptObject (this=0x21f13d0, obj=0x2d7e980, type=0x233e360) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptengine.cpp:5150\r\n#8  0x0000000000f82e08 in Urho3D::CScriptArray::Destruct (this=0x2fe9980, buf=0x3a23bc0, start=0, end=4048) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/Addons.cpp:812\r\n#9  0x0000000000f82bb8 in Urho3D::CScriptArray::DeleteBuffer (this=0x2fe9980, buf=0x3a23bc0) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/Addons.cpp:758\r\n#10 0x0000000000f8220c in Urho3D::CScriptArray::~CScriptArray (this=0x2fe9980, __in_chrg=<optimized out>) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/Addons.cpp:497\r\n#11 0x0000000000f84d0a in Urho3D::CScriptArray::Release (this=0x2fe9980) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/Addons.cpp:1556\r\n#12 0x0000000000df489a in asCScriptEngine::CallObjectMethod (this=0x21f13d0, obj=0x2fe9980, i=0x21fa250, s=0x21fa7e0) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptengine.cpp:3998\r\n#13 0x0000000000df4777 in asCScriptEngine::CallObjectMethod (this=0x21f13d0, obj=0x2fe9980, func=25) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptengine.cpp:3970\r\n#14 0x0000000000e0a988 in asCScriptObject::FreeObject (this=0x314b530, ptr=0x2fe9980, objType=0x2b5ced0, engine=0x21f13d0) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptobject.cpp:944\r\n#15 0x0000000000e0937c in asCScriptObject::~asCScriptObject (this=0x314b530, __in_chrg=<optimized out>) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptobject.cpp:368\r\n#16 0x0000000000e090a9 in asCScriptObject::Destruct (this=0x314b530) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptobject.cpp:308\r\n#17 0x0000000000e09a16 in asCScriptObject::Release (this=0x314b530) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptobject.cpp:550\r\n#18 0x0000000000e1cdd8 in asCGarbageCollector::DestroyOldGarbage (this=0x21f2540) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_gc.cpp:571\r\n#19 0x0000000000e1bca7 in asCGarbageCollector::AddScriptObjectToGC (this=0x21f2540, obj=0x37e5710, objType=0x25269b0) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_gc.cpp:107\r\n#20 0x0000000000e08f0a in asCScriptObject::asCScriptObject (this=0x37e5710, ot=0x25269b0, doInitialize=true) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptobject.cpp:258\r\n#21 0x0000000000e08d98 in ScriptObject_Construct (objType=0x25269b0, self=0x37e5710) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptobject.cpp:239\r\n#22 0x0000000000e12cb2 in asCContext::ExecuteNext (this=0x2be0150) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_context.cpp:2666\r\n#23 0x0000000000e0fb86 in asCContext::Execute (this=0x2be0150) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_context.cpp:1292\r\n#24 0x00000000008ba9c8 in Urho3D::ScriptFile::Execute (this=0x2ad3040, function=0x2b42450, parameters=..., unprepare=true) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/ScriptFile.cpp:324\r\n#25 0x00000000008ba89a in Urho3D::ScriptFile::Execute (this=0x2ad3040, declaration=..., parameters=..., unprepare=true) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/ScriptFile.cpp:303\r\n#26 0x0000000000888230 in Urho3DPlayer::Start (this=0x1c0f8c0) at /home/slapin/Urho3D/Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp:174\r\n#27 0x0000000000a9aaa3 in Urho3D::Application::Run (this=0x1c0f8c0) at /home/slapin/Urho3D/Source/Urho3D/Engine/Application.cpp:80\r\n#28 0x0000000000887a8f in RunApplication () at /home/slapin/Urho3D/Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp:41\r\n#29 0x0000000000887b36 in main (argc=8, argv=0x7fffffffe1c8) at /home/slapin/Urho3D/Source/Tools/Urho3DPlayer/Urho3DPlayer.cpp:41\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/urho3d/Urho3D/issues/comments/249282100","html_url":"https://github.com/urho3d/Urho3D/issues/1613#issuecomment-249282100","issue_url":"https://api.github.com/repos/urho3d/Urho3D/issues/1613","id":249282100,"user":{"login":"cadaver","id":51361,"avatar_url":"https://avatars.githubusercontent.com/u/51361?v=3","gravatar_id":"","url":"https://api.github.com/users/cadaver","html_url":"https://github.com/cadaver","followers_url":"https://api.github.com/users/cadaver/followers","following_url":"https://api.github.com/users/cadaver/following{/other_user}","gists_url":"https://api.github.com/users/cadaver/gists{/gist_id}","starred_url":"https://api.github.com/users/cadaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cadaver/subscriptions","organizations_url":"https://api.github.com/users/cadaver/orgs","repos_url":"https://api.github.com/users/cadaver/repos","events_url":"https://api.github.com/users/cadaver/events{/privacy}","received_events_url":"https://api.github.com/users/cadaver/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T19:29:56Z","updated_at":"2016-09-23T19:29:56Z","body":"The crash dump indicates an Urho refcounted object being released. Which Urho object you have in your data structure?\r\n\r\nPlease give an actual minimal runnable code example that can be run and reproduces the crash. My guess is an interaction between Angelscript GC, Angelscript arrays, and Urho refcounting, but it's hard to tell exactly unless there's a working program."}}
{"actor":{"display_login":"cadaver"}}