Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Memory corruption? #86

Closed
andreasdr opened this issue Jan 29, 2019 · 30 comments
Closed

Memory corruption? #86

andreasdr opened this issue Jan 29, 2019 · 30 comments
Assignees
Labels

Comments

@andreasdr
Copy link

Hi,

I have enabled assertions recently in our game and hit an assertion, looks like a possible memory corruption to me if assertions are disabled.
The assertion is hit at:

It happens when trying to check if a player can spawn using this logic:

Any ideas? We had a related bug before but you fixed it.

Many thanx and

Best regards
Andreas

@DanielChappuis
Copy link
Owner

Hello. Thanks for reporting this.

Do you have an entire stack trace of the assert by any chance ?

@DanielChappuis DanielChappuis self-assigned this Jan 29, 2019
@andreasdr
Copy link
Author

Hi,

I seem to have random crashes. But all happen in RP3D. One stack trace looks like:

frame #0: 0x000000080155a45a libc.so.7`_thr_kill + 10
frame #1: 0x0000000801558844 libc.so.7`_raise + 52
frame #2: 0x00000008014cb079 libc.so.7`abort + 73
frame #3: 0x00000008015482c1 libc.so.7`__assert + 81
frame #4: 0x000000000075f5b5 ASW`reactphysics3d::BroadPhaseAlgorithm::computeOverlappingPairs(reactphysics3d::MemoryManager&) [inlined] reactphysics3d::Set<int>::Iterator::operator*(void) const at Set.h:336
frame #5: 0x000000000075f59c ASW`reactphysics3d::BroadPhaseAlgorithm::computeOverlappingPairs(this=0x0000000801be6fb8, memoryManager=<unavailable>) at BroadPhaseAlgorithm.cpp:168
frame #6: 0x0000000000773231 ASW`reactphysics3d::CollisionDetection::computeCollisionDetection(void) [inlined] reactphysics3d::CollisionDetection::computeBroadPhase(this=<unavailable>) at CollisionDetection.cpp:100
frame #7: 0x0000000000773219 ASW`reactphysics3d::CollisionDetection::computeCollisionDetection(this=0x0000000801be6eb0) at CollisionDetection.cpp:77
frame #8: 0x000000000077b31d ASW`reactphysics3d::DynamicsWorld::update(this=0x0000000801be6a00, timeStep=<unavailable>) at DynamicsWorld.cpp:126
frame #9: 0x000000000060e9fe ASW`tdme::engine::physics::World::update(this=0x0000000801be6a00, deltaTime=<unavailable>) at World.cpp:148
frame #10: 0x000000000047bd38 ASW`asw::ASWClientGameLogicThread::run(this=0x000000080370c300) at ASWClientGameLogicThread.cpp:266
frame #11: 0x00000000006bcdda ASW`tdme::os::threading::Thread::pThreadRun(thread=<unavailable>) at Thread.cpp:73

Not yet sure whats the origin :/

Maybe I will have a session and debug my stuff as well like adding asserts to array access of vector and such. Hmm.

Really sure that it is no multithreading issue (I have several worlds in one application as we include server now in game application process and have a additional pathfinding world for both)

If I get another crashes I will notify you.

I am using a older RP3D 0.7 version. Do you think it makes sense to update?

Sometimes RP3D uses several seconds to compute a dynamics world. I guess this is also a misbehaviour due to memory corruption, but I have no prove yet. Just like I said it could happen that the error is on my side.

Many thanx and

Best regards
Andreas

@andreasdr
Copy link
Author

Hi,

Please see attached a second one:

Assertion failed: (mEntries[entryIndex].value == nullptr), function add, file ext/reactphysics3d/src/containers/Set.h, line 496.
Abort trap (core dumped)
$ lldb -c ASW.core ./bin/asw/ASW
(lldb) target create "./bin/asw/ASW" --core "ASW.core"
bt
Core file '/usr/home/andreas/Development/drewke.net/MedievalSurvivors/ASW.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'ASW', stop reason = signal SIGABRT
  * frame #0: 0x000000080157545a libc.so.7`_thr_kill + 10
    frame #1: 0x0000000801573844 libc.so.7`_raise + 52
    frame #2: 0x00000008014e6079 libc.so.7`abort + 73
    frame #3: 0x00000008015632c1 libc.so.7`__assert + 81
    frame #4: 0x0000000000777eb0 ASW`reactphysics3d::Set<int>::add(this=0x000000080370afe0, value=0x00007fffffff802c) at Set.h:496
    frame #5: 0x0000000000779eed ASW`reactphysics3d::BroadPhaseAlgorithm::addProxyCollisionShape(reactphysics3d::ProxyShape*, reactphysics3d::AABB const&) [inlined] reactphysics3d::BroadPhaseAlgorithm::addMovedCollisionShape(this=<unavailable>, broadPhaseID=1043) at BroadPhaseAlgorithm.h:245
    frame #6: 0x0000000000779edd ASW`reactphysics3d::BroadPhaseAlgorithm::addProxyCollisionShape(this=<unavailable>, proxyShape=0x00000008935c5ec0, aabb=<unavailable>) at BroadPhaseAlgorithm.cpp:105
    frame #7: 0x00000000007791c1 ASW`reactphysics3d::RigidBody::addCollisionShape(reactphysics3d::CollisionShape*, reactphysics3d::Transform const&, float) [inlined] reactphysics3d::CollisionDetection::addProxyCollisionShape(this=<unavailable>, proxyShape=<unavailable>, aabb=0x3e9999a0be4ccccd) at CollisionDetection.h:257
    frame #8: 0x00000000007791af ASW`reactphysics3d::RigidBody::addCollisionShape(this=0x0000000893e34c98, collisionShape=<unavailable>, transform=<unavailable>, mass=<unavailable>) at RigidBody.cpp:303
    frame #9: 0x0000000000621c59 ASW`tdme::engine::physics::Body::resetProxyShapes(this=0x00000008935d3280) at Body.cpp:278
    frame #10: 0x0000000000621459 ASW`tdme::engine::physics::Body::fromTransformations(this=0x00000008935d3280, transformations=0x00007fffffff8720) at Body.cpp:470
    frame #11: 0x0000000000621281 ASW`tdme::engine::physics::Body::Body(this=0x00000008935d3280, world=<unavailable>, id=<unavailable>, type=<unavailable>, enabled=true, collisionTypeId=1, transformations=0x00007fffffff8720, restitution=0, friction=0.5, mass=0, inertiaTensor=0x00007fffffff8338, boundingVolumes=vector<tdme::engine::primitives::BoundingVolume *, std::__1::allocator<tdme::engine::primitives::BoundingVolume *> > @ 0x00007fffffff8320) at Body.cpp:105
    frame #12: 0x0000000000623ecd ASW`tdme::engine::physics::World::addStaticRigidBody(this=0x000000080370aa00, id=0x00000008aeed7578, enabled=true, collisionTypeId=1, transformations=<unavailable>, friction=0.5, boundingVolumes=vector<tdme::engine::primitives::BoundingVolume *, std::__1::allocator<tdme::engine::primitives::BoundingVolume *> > @ 0x00007fffffff8690) at World.cpp:106
    frame #13: 0x00000000006d8b23 ASW`tdme::tools::leveleditor::logic::Level::createBody(world=0x000000080370aa00, levelEditorEntity=0x0000000805c6fc00, id=0x00000008aeed7578, transformations=0x00007fffffff8720, collisionTypeId=<unavailable>) at Level.cpp:461
    frame #14: 0x00000000006d90a5 ASW`tdme::tools::leveleditor::logic::Level::createBody(world=0x000000080370aa00, levelEditorObject=<unavailable>, translation=0x00007fffffff8800, collisionTypeId=0) at Level.cpp:494
    frame #15: 0x00000000006d916a ASW`tdme::tools::leveleditor::logic::Level::addLevel(world=0x000000080370aa00, level=0x000000080370a230, enable=true, translation=0x00007fffffff95a8) at Level.cpp:501
    frame #16: 0x000000000041c95d ASW`asw::ASW::joinGame(this=0x000000080370a000) at ASW.cpp:706
    frame #17: 0x0000000000418491 ASW`asw::ASW::display(this=0x000000080370a000) at ASW.cpp:312
    frame #18: 0x00000000006029d1 ASW`tdme::application::Application::glutDisplay(void) at Application.cpp:389
    frame #19: 0x0000000800f0381c libglut.so.3`glutMainLoop + 188
    frame #20: 0x00000000006027e9 ASW`tdme::application::Application::run(this=0x000000080370a7f0, argc=1, argv=<unavailable>, title=0x00007fffffffd628, inputEventHandler=<unavailable>) at Application.cpp:374
    frame #21: 0x0000000000601496 ASW`main(argc=1, argv=0x00007fffffffd888) at ASW-main.cpp:43
    frame #22: 0x000000000040a01b ASW`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76
(lldb) 

@DanielChappuis
Copy link
Owner

Thanks.
Are you able to test and confirm that this issue also appears in the master branch ?

@andreasdr
Copy link
Author

Hi,

I did a quick test and several assertions crashes occurred. I will report exactly soon.
I hope we can get this to work 100%.

Many thanx and
Best regards
Andreas

@DanielChappuis
Copy link
Owner

Is there a way for me to checkout your code in order to reproduce on my side ?

@andreasdr
Copy link
Author

The game itself is closed source. I have to decide with our team. I will write you an email.

@DanielChappuis
Copy link
Owner

Ok I understand. I will first try to find the issue without the sources. I am currently busy with another issue and then I will focus on this one.

@DanielChappuis
Copy link
Owner

Hello,

You gave me a stack trace for the two following errors:

frame #4: 0x000000000075f5b5 ASW reactphysics3d::BroadPhaseAlgorithm::computeOverlappingPairs(reactphysics3d::MemoryManager&) [inlined] reactphysics3d::Set<int>::Iterator::operator*(void) const at Set.h:336

and

frame #4: 0x0000000000777eb0 ASW reactphysics3d::Set<int>::add(this=0x000000080370afe0, value=0x00007fffffff802c) at Set.h:496

Do you have the states of all the variables of the Set object at the line of the asserts for each of those two errors ?

Something seems to be wrong in the Set class and I am trying to figure out what is it.

@andreasdr
Copy link
Author

I will check this and give you infos tomorrow at latest. Most crashes I seem to have are really RP3D set related!

@andreasdr
Copy link
Author

We have implemented game shutdown and such. From time to time I see this assertion:

Assertion failed: (mNbTimesAllocateMethodCalled == 0), function ~PoolAllocator, file ext/reactphysics3d/src/memory/PoolAllocator.cpp, line 94.

Backtrace:

* thread #1, name = 'ASW', stop reason = signal SIGABRT
  * frame #0: 0x00000008013e245a libc.so.7`_thr_kill + 10
    frame #1: 0x00000008013e0844 libc.so.7`_raise + 52
    frame #2: 0x0000000801353079 libc.so.7`abort + 73
    frame #3: 0x00000008013d02c1 libc.so.7`__assert + 81
    frame #4: 0x00000000005d806d ASW`reactphysics3d::PoolAllocator::~PoolAllocator(this=0x000000080460c408) at PoolAllocator.cpp:94
    frame #5: 0x00000000004a8744 ASW`tdme::engine::physics::World::~World(this=0x000000080460c400) at World.cpp:74
    frame #6: 0x000000000041c87a ASW`asw::ASWContext::~ASWContext(this=0x0000000809bdbd00) at ASWContext.cpp:266
    frame #7: 0x0000000000412ac5 ASW`asw::ASW::stopClient(this=0x0000000803573000) at ASW.cpp:1053
    frame #8: 0x000000000040e048 ASW`asw::ASW::display(this=0x0000000803573000) at ASW.cpp:374
    frame #9: 0x00000000004897e6 ASW`tdme::application::Application::glutDisplay(void) at Application.cpp:397
    frame #10: 0x0000000800d7081c libglut.so.3`glutMainLoop + 188
    frame #11: 0x0000000000489681 ASW`tdme::application::Application::run(this=0x0000000803573390, argc=1, argv=<unavailable>, title=0x00007fffffffd7e0, inputEventHandler=<unavailable>) at Application.cpp:382
    frame #12: 0x0000000000486ec1 ASW`main(argc=1, argv=0x00007fffffffd888) at ASW-main.cpp:43
    frame #13: 0x000000000040ab7b ASW`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76

Variables:

(lldb) frame variable *this
(reactphysics3d::PoolAllocator) *this = {
  mFreeMemoryUnits = {
    [0] = 0x000000082c962950
    [1] = 0x000000082bb36530
    [2] = 0x0000000000000000
    [3] = 0x000000082c9bf0a0
    [4] = 0x000000083ae24c80
    [5] = 0x0000000000000000
    [6] = 0x0000000000000000
    [7] = 0x000000080b791900
    [8] = 0x000000082bb42d88
    [9] = 0x000000083ae2eb00
    [10] = 0x0000000000000000
    [11] = 0x000000082b964ca0
    [12] = 0x00000008a8ccdb40
    [13] = 0x0000000000000000
    [14] = 0x000000083ae29d80
    [15] = 0x000000083ae15ec0
    [16] = 0x0000000000000000
    [17] = 0x0000000000000000
    [18] = 0x000000082c338600
    [19] = 0x0000000000000000
    [20] = 0x00000008cadd36a8
    [21] = 0x0000000000000000
    [22] = 0x0000000000000000
    [23] = 0x0000000000000000
    [24] = 0x0000000000000000
    [25] = 0x0000000000000000
    [26] = 0x0000000000000000
    [27] = 0x0000000000000000
    [28] = 0x0000000000000000
    [29] = 0x0000000000000000
    [30] = 0x0000000000000000
    [31] = 0x000000082c7a2000
    [32] = 0x0000000000000000
    [33] = 0x0000000000000000
    [34] = 0x0000000000000000
    [35] = 0x00000008429c9080
    [36] = 0x0000000000000000
    [37] = 0x0000000000000000
    [38] = 0x0000000000000000
    [39] = 0x0000000000000000
    [40] = 0x000000082c880a80
    [41] = 0x0000000000000000
    [42] = 0x0000000000000000
    [43] = 0x0000000000000000
    [44] = 0x000000082c9fb200
    [45] = 0x0000000000000000
    [46] = 0x0000000000000000
    [47] = 0x0000000804f9bec0
    [48] = 0x0000000000000000
    [49] = 0x0000000000000000
    [50] = 0x000000082c7458c0
    [51] = 0x0000000000000000
    [52] = 0x0000000000000000
    [53] = 0x0000000000000000
    [54] = 0x0000000000000000
    [55] = 0x0000000000000000
    [56] = 0x0000000000000000
    [57] = 0x0000000000000000
    [58] = 0x0000000000000000
    [59] = 0x0000000000000000
    [60] = 0x0000000000000000
    [61] = 0x0000000000000000
    [62] = 0x0000000000000000
    [63] = 0x000000082c1972c0
    [64] = 0x0000000000000000
    [65] = 0x0000000000000000
    [66] = 0x0000000000000000
    [67] = 0x0000000000000000
    [68] = 0x0000000000000000
    [69] = 0x0000000000000000
    [70] = 0x0000000000000000
    [71] = 0x0000000000000000
    [72] = 0x0000000000000000
    [73] = 0x0000000000000000
    [74] = 0x0000000000000000
    [75] = 0x0000000000000000
    [76] = 0x0000000000000000
    [77] = 0x0000000000000000
    [78] = 0x0000000000000000
    [79] = 0x0000000000000000
    [80] = 0x0000000000000000
    [81] = 0x0000000000000000
    [82] = 0x0000000000000000
    [83] = 0x0000000000000000
    [84] = 0x0000000000000000
    [85] = 0x0000000000000000
    [86] = 0x0000000000000000
    [87] = 0x0000000000000000
    [88] = 0x0000000000000000
    [89] = 0x0000000000000000
    [90] = 0x0000000000000000
    [91] = 0x0000000000000000
    [92] = 0x0000000000000000
    [93] = 0x0000000000000000
    [94] = 0x0000000000000000
    [95] = 0x00000008cbeef380
    [96] = 0x0000000000000000
    [97] = 0x0000000000000000
    [98] = 0x000000082ca16940
    [99] = 0x0000000000000000
    [100] = 0x0000000000000000
    [101] = 0x0000000000000000
    [102] = 0x0000000000000000
    [103] = 0x0000000000000000
    [104] = 0x0000000000000000
    [105] = 0x0000000000000000
    [106] = 0x0000000000000000
    [107] = 0x0000000000000000
    [108] = 0x0000000000000000
    [109] = 0x0000000000000000
    [110] = 0x000000082c33d040
    [111] = 0x0000000000000000
    [112] = 0x0000000000000000
    [113] = 0x0000000000000000
    [114] = 0x0000000000000000
    [115] = 0x0000000000000000
    [116] = 0x0000000000000000
    [117] = 0x0000000000000000
    [118] = 0x0000000000000000
    [119] = 0x0000000000000000
    [120] = 0x0000000000000000
    [121] = 0x0000000000000000
    [122] = 0x0000000000000000
    [123] = 0x0000000000000000
    [124] = 0x0000000000000000
    [125] = 0x0000000000000000
    [126] = 0x0000000000000000
    [127] = 0x000000082ca00140
  }
  mMemoryBlocks = 0x0000000809d0b400
  mNbAllocatedMemoryBlocks = 64
  mNbCurrentMemoryBlocks = 59
  mNbTimesAllocateMethodCalled = -9
}
(lldb) 

Hope this helps for this assertion.

@andreasdr
Copy link
Author

Damn. Tried to catch the other ones. When I get them the backtraces makes no sense and are broken.

@andreasdr
Copy link
Author

E.g. see this backtrace:

Every frame < 11 is broken. But this might give a hint still.

    frame #11: 0x00000000006c2805 ASW`tdme::engine::physics::Body::resetProxyShapes(this=0x000000084c43d780) at Body.cpp:278
    frame #12: 0x00000000006c0ad7 ASW`tdme::engine::physics::Body::fromTransformations(this=0x000000084c43d780, transformations=0x00007fffffff7db8) at Body.cpp:470
    frame #13: 0x00000000006c0998 ASW`tdme::engine::physics::Body::Body(this=0x000000084c43d780, world=0x0000000803b92400, id=0x00000008b36abeb8, type=0, enabled=true, collisionTypeId=1, transformations=0x00007fffffff7db8, restitution=0, friction=0.5, mass=0, inertiaTensor=0x00007fffffff6f38, boundingVolumes=vector<tdme::engine::primitives::BoundingVolume *, std::__1::allocator<tdme::engine::primitives::BoundingVolume *> > @ 0x00007fffffff6f10) at Body.cpp:105
    frame #14: 0x00000000006cb6f3 ASW`tdme::engine::physics::World::addStaticRigidBody(this=0x0000000803b92400, id=0x00000008b36abeb8, enabled=true, collisionTypeId=1, transformations=0x00007fffffff7db8, friction=0.5, boundingVolumes=vector<tdme::engine::primitives::BoundingVolume *, std::__1::allocator<tdme::engine::primitives::BoundingVolume *> > @ 0x00007fffffff73e0) at World.cpp:108
    frame #15: 0x000000000091b759 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_pointer(this=0x000000084c43d7a0) const at string:0
    frame #16: 0x000000000091b6e5 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::data(this=0x000000084c43d7a0) const at string:1137
    frame #17: 0x000000000091b6e5 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(this=0x0000000303b92c78, __str=0x000000084c43d7a0) at string:2334
    frame #18: 0x000000000091b698 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] _ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEOS9_SA_(__lhs=0x000000084c43d7a0, __rhs=0x000000084c43d7a0) at string:3845
    frame #19: 0x000000000091b675 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(this=0x000000003f800000, context=0x0000000000b0a7d0, playerId=0x00007fffffff5b20, buildingType=8, buildingIdx=62466488, transformations=0x000007b5ffff5bc0, building=0x000000083cb47420, constructionLevelEditorEntities=0x000000084c43d600, buildingLevelEditorEntity=0x00000008b36abeb8) at PlayerBuildingLogic.cpp:763
    frame #20: 0x000000000091bc20 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] _ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEOS9_SA_(__lhs=0x00007fffffff6f10, __rhs=0x0000000000453a02) at string:3845
    frame #21: 0x000000000091bc05 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(this=0x00007fffffff5e0c, context=0x0000000003d06c00, playerId=0x00007fffffff5de8, buildingType=32767, buildingIdx=-41456, transformations=0x0000000800000000, building=0x00007fffffff73d8, constructionLevelEditorEntities=0x00007fffffff73d8, buildingLevelEditorEntity=0x00007fffffff73f0) at PlayerBuildingLogic.cpp:766
    frame #22: 0x000000000091bd08 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_pointer(this=0x00000008b36abeb8) const at string:0
    frame #23: 0x000000000091bc75 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::data(this=0x010000013f000000) const at string:1137
    frame #24: 0x000000000091bc75 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(this=0x00000000ffff73e0, __str=0x0000000000000001) at string:2334
    frame #25: 0x000000000091bc28 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(asw::ASWContext*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&, int, int, tdme::engine::Transformations const&, asw::ASWGameDesign::Building const&, asw::ASWContext*::vector<std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity*, asw::ASWContext*::char_traits<char><std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity> >*, std::__1::basic_string<char, asw::ASWContext*::char_traits<char>, asw::ASWContext*::allocator<char> > const&::tools::shared::model::LevelEditorEntity) [inlined] _ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEOS9_SA_(__lhs=0x0000000000000001, __rhs=0x00007fffffff73e0) at string:3845
    frame #26: 0x000000000091bc05 ASW`asw::logics::buildings::PlayerBuildingLogic::PlayerBuildingLogic(this=0xbf800000bf800000, context=0x3f80000000000000, playerId=0x000000084c435808, buildingType=0, buildingIdx=0, transformations=0x00007fffffff64d8, building=0x00007fffffff8c28, constructionLevelEditorEntities=0x000000000085a0f1, buildingLevelEditorEntity=0x00000008053f3720) at PlayerBuildingLogic.cpp:766
    frame #27: 0x000000000041faf2 ASW`asw::ASW::startGame(this=0x0000000801ff7000) at ASW.cpp:931
    frame #28: 0x0000000000414364 ASW`asw::ASW::display(this=0x0000000801ff7000) at ASW.cpp:296
    frame #29: 0x0000000000634e0f ASW`tdme::application::Application::glutDisplay(void) at Application.cpp:397
    frame #30: 0x00000008012f981c libglut.so.3`glutMainLoop + 188
    frame #31: 0x0000000000634cce ASW`tdme::application::Application::run(this=0x0000000801ff7390, argc=1, argv=0x00007fffffffd888, title=0x00007fffffffd628, inputEventHandler=0x0000000000000000) at Application.cpp:382
    frame #32: 0x0000000000627606 ASW`main(argc=1, argv=0x00007fffffffd888) at ASW-main.cpp:43
    frame #33: 0x000000000040aceb ASW`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1.c:76

@andreasdr
Copy link
Author

Also frame 15 til frame 25 seem to make no sense.

@andreasdr
Copy link
Author

Hi Daniel,

I had errors my code regarding multi threading. Now we have only hit the following one after lots of fixes:

Assertion failed: (broadPhaseID >= 0), function updateProxyCollisionShape, file ext/reactphysics3d/src/collision/broadphase/BroadPhaseAlgorithm.cpp, line 131.
Abort trap (core dumped)
$ lldb -c ASW.core ./bin/asw/ASW
(lldb) target create "./bin/asw/ASW" --core "ASW.core"
Core file '/usr/home/andreas/Development/drewke.net/MedievalSurvivors/ASW.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'ASW', stop reason = signal SIGABRT
  * frame #0: 0x000000080147145a libc.so.7`_thr_kill + 10
    frame #1: 0x000000080146f844 libc.so.7`_raise + 52
    frame #2: 0x00000008013e2079 libc.so.7`abort + 73
    frame #3: 0x000000080145f2c1 libc.so.7`__assert + 81
    frame #4: 0x000000000063e8ec ASW`reactphysics3d::BroadPhaseAlgorithm::updateProxyCollisionShape(this=<unavailable>, proxyShape=<unavailable>, aabb=<unavailable>, displacement=<unavailable>, forceReinsert=<unavailable>) at BroadPhaseAlgorithm.cpp:131
    frame #5: 0x000000000063e185 ASW`reactphysics3d::RigidBody::updateBroadPhaseState(void) const [inlined] reactphysics3d::CollisionDetection::updateProxyCollisionShape(aabb=0x3fbcfb10412f92e6, displacement=0x0000000000000000, forceReinsert=false) at CollisionDetection.h:287
    frame #6: 0x000000000063e16b ASW`reactphysics3d::RigidBody::updateBroadPhaseState(this=0x000000081b4d77c0) const at RigidBody.cpp:560
    frame #7: 0x00000000004dac76 ASW`tdme::engine::physics::Body::fromTransformations(this=0x0000000805084180, transformations=<unavailable>) at Body.cpp:505
    frame #8: 0x000000000044a0c5 ASW`asw::logics::PlayerLogic::updateGameLogic(this=0x000000080508da00) at PlayerLogic.cpp:599
    frame #9: 0x0000000000434ffa ASW`asw::ASWClientGameLogicThread::run(this=0x0000000803c0e920) at ASWClientGameLogicThread.cpp:122
    frame #10: 0x0000000000594d5a ASW`tdme::os::threading::Thread::pThreadRun(thread=<unavailable>) at Thread.cpp:73
    frame #11: 0x000000080129f776 libthr.so.3`___lldb_unnamed_symbol1$$libthr.so.3 + 326
(lldb) 

And sometimes a World::update() takes like 2 seconds. Any idea what this could be about?

Many thanx and

Best regards
Andreas

@DanielChappuis
Copy link
Owner

DanielChappuis commented Mar 10, 2019 via email

@andreasdr
Copy link
Author

Hi,

could be that I changed the code for testing, but we had those crashes after that too. I will investigate on next crash and give frame variables and such.

Unfortunately it happens rarely.

Many thanx and

Best regards
Andreas

@DanielChappuis
Copy link
Owner

Is it possible that the body in which you manually call updateBroadPhaseState() is not part of the physics world anymore ?

@andreasdr
Copy link
Author

Good question. Looked at the code. Rather looks like it can be disabled but not removed.

Using:
collisionBody->setIsActive(false);

Do you think this could be an issue?

@DanielChappuis
Copy link
Owner

Yes that might be the issue.

If you do not want to destroy the body using the CollisionWorld::destroyCollisionBody() method because you want to reuse it in the future, you can disable a body temporarily using the CollisionBody::setIsActive(false) method.

This method will remove the collision shapes of the body from the broad-phase collision detection. Therefore a body that is inactive won't be able to collide or be tested for raycasting. This body is still part of the world but is not simulated anymore.

I think that might be the issue. It seems that you manually called the CollisionBody::updateBroadPhaseState() method on this body which will try to update the broad-phase state of each collision shape of this body but they are not part of the broad-phase anymore because the body is deactivated.

@andreasdr
Copy link
Author

But we have this issue also with your stock RP3D allocator branch. Just to mention. However if it happens again I will try to gather more information.

@DanielChappuis
Copy link
Owner

Ok I have found that in the CollisionBody::updateBroadPhaseState() method I was checking for broadPhaseId != 1 before trying to update the broad-phase but this check was missing from the RigidBody::updateBroadPhaseState() version of the method.

This is now fixed in the master and allocators branches.

Could you please pull this branch and let me know if you still observe the issue or not ?

@andreasdr
Copy link
Author

Nice!!! Will test tomorrow at the latest.

@andreasdr
Copy link
Author

Hi Daniel.

we are like testing a day now and had no issues with RP3D so far. Ill keep you updated. I think you can close this issue end of the week if nothing pops up.

Many thanx!

@DanielChappuis
Copy link
Owner

Ok that's good news. Thanks for the feedback.

@andreasdr
Copy link
Author

Hi, we had 2 asserts today. No backtraces yet. I have a bug in Console logging that's why they are missing. Sorry. Need to fix that.

Assertion failed!
Program: C:\Users\kolja\Downloads\asw-windows-x64_2019-03-13-19-09\package\asw\ASW.exe
File: ext/reactphysics3d/src/engine/OverlappingPair.cpp, Line 48
Expression: mPotentialContactManifolds == nullptr

Assertion failed!
Program: C:\Users\kolja\Downloads\asw-windows-x64_2019-03-13-19-09\package\asw\ASW.exe
File: ext/reactphysics3d/src/containers/Map.h, Line 345
Expression: mEntries[mCurrentEntry].keyValue != nullptr

Hmm. Not sure if this is still the right place to post these.

Just tell me how to proceed please.

@andreasdr
Copy link
Author

Maybe another multithreading issue. I will check. But maybe you have an idea too.

@DanielChappuis
Copy link
Owner

No problem to post these here. I also suspect a multithreading issue. The Map.h error is very similar to the one you had few days before with the Set.h error.

@DanielChappuis
Copy link
Owner

Have you been able to fix the issue ?

@andreasdr
Copy link
Author

Hmm. We have not seen it another time. I guess you can just close this issue.

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

No branches or pull requests

2 participants