Jump to content
  • Advertisement
Sign in to follow this  
cvet

Hang/crash on finishing

This topic is 2936 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

AS revision 659.
Application hanged on closing.
If load previous bytecode than application crashed on closing.

Example for reproduce:

interface ITest
{
}

class Test : ITest
{
ITest@[] arr;

void Set(ITest@ e)
{
arr.resize(1);
@arr[0]=e;
}
}

void main()
{
Test@ t=Test();
t.Set(t);
}


Share this post


Link to post
Share on other sites
Advertisement
Fixed in revision 670.

It was a bug in the array object (both built-in and add-on) where it didn't release the references when the GC told it to. This prevented the GC from breaking the circular references, thus detecting the same circular reference over and over again.

Share this post


Link to post
Share on other sites
Infinite loop gone, but crash still.

Access violation reading location 0x000000e4.


asCScriptEngine::CallObjectMethodRetInt() + 0x39 bytes
asCGarbageCollector::IdentifyGarbageWithCyclicRefs() + 0x6c bytes


; 3019 : asSSystemFunctionInterface *i = s->sysFuncIntf;

00039 8b b0 e4 00 00
00 mov esi, DWORD PTR [eax+228]


Share this post


Link to post
Share on other sites
Ah, I didn't catch that. You say this happens after loading pre-compiled bytecode?

I'll look into this tonight when I get home.

Share this post


Link to post
Share on other sites
Fixed in revision 672.

This was a bit more difficult to find. I had a situation where the array type wasn't flagged as garbage collected as it should when it was created during the loading of bytecode.

Share this post


Link to post
Share on other sites
Still having this with rev 673 (although not with the original example), and I think there's more to it than just garbager, as some of registered global variables failed to be set properly by the script. Will try to produce a compact example soon.

Share this post


Link to post
Share on other sites
It took a while, but here it is, revision 673:

Reason/asm:

Access violation reading location 0x000000e4.

0052C351 mov esi,dword ptr [ebx+0E4h]



Call stack:

asCScriptEngine::CallObjectMethodRetInt() + 0x61 bytes C++
asCGarbageCollector::IdentifyGarbageWithCyclicRefs() + 0x93 bytes C++
asCGarbageCollector::GarbageCollect() + 0x67 bytes C++



Source:

as_scriptengine.cpp:
asSSystemFunctionInterface *i = s->sysFuncIntf; // s is NULL at this point



Why?

as_gc.cpp:
int refCount = engine->CallObjectMethodRetInt(gcObj.obj, gcObj.type->beh.gcGetRefCount); // gcObj.type->beh.gcGetRefCount is 0



How to reproduce?

interface ITest1 { }
interface ITest2 { }

CTest@[] Array1;

class CTest : ITest1
{
CTest()
{
Index=0;
@Field=null;
}

int Index;
ITest2@ Field;
}

int GetTheIndex()
{
return Array1[0].Index;
}

void Test()
{
Array1.resize(1);
CTest test();
@Array1[0] = test;
GetTheIndex();
}


And run Test() once. It's interesting that attempts to simplify this example make the bug "go away".

Share this post


Link to post
Share on other sites
This doesn't happen with revision 681. I think I fixed this problem with a previous code change, where I modified how an array object is determined to be garbage collected or just reference counted.

Let me know if the problem persists with the latest revision.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!