Possible bug in b2ChainShape

Hi,
recently i have encountered kinda major bug, namely it is tunneling of a static chain shape and a dynamic polygon.

Here is the code, which generates a chain shape:
Code:
    b2Vec2 pointz[] = {
        b2Vec2(31, 13), b2Vec2(40, 38), b2Vec2(25, 12)
    };
    b2ChainShape shape;
    shape.CreateLoop(pointz, 3);
    b2BodyDef def;
    b2Body* lulzBody = world.CreateBody(&def);
    lulzBody->SetType(b2_staticBody);
    lulzBody->CreateFixture(&shape, 0);


And here the code which generates my movable polygon:
Code:
    b2BodyDef bodyDef;
    bodyDef.position.Set(60, 1);
    b2Body* pBody = world.CreateBody(&bodyDef);

    b2PolygonShape box;
    box.SetAsBox(1, 1);
    pBody->CreateFixture(&box, 0);
    pBody->SetType(b2_dynamicBody);


Yea, I know, nothing special in here.

I also noticed, that tunneling occurs almost everytime, when the chain contains very sharp angles.
It is also worth mentioning that if i replace b2ChainShape with a set of b2EdgeShape, then everything works like a charm.
Is this because of the size of my polygon? How should i try to fix that?

I attached a pic of this situation.
I think this has to do with how the ghost vertices work. They are intended to improve the behavior of sliding over two consecutive edge segments which are of a similar orientation, usually the surface of the ground so mostly flat or curving.

I've noticed that if you have two consecutive edge segments with greatly varying orientation, the 'helpful' calculation done by the ghost vertices is not so helpful. I think my question here may be the same problem as what you've got there: http://code.google.com/p/box2d/issues/detail?id=286
I did not think of using separate edge segments...! That would be a reasonable workaround. It would be nice to know what the important angle is though - I'm guessing 90 degrees is the point at which things start to go wrong. For angles above 90 degrees it doesn't make sense to use ghost vertices anyway.
Well, i came up with a really simple solution. I dropped the usage of chain shape and i decided to maintain ghost vertices on my own.
I just don't add those ghost vertices if the angle between two edges is smaller than 90 degrees. Thx for giving me a clue.
This is a limitation of the current algorithm. It tries to provide smooth double-sided collision. This means you must bury isolated vertices. The pop occurs when the centroid of the polygon goes behind the chain.

Original thread: https://box2d.org/forum/viewtopic.php?t=8867