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

Major random bug causes the engine to quickly go on a downward spiral until it crashes #508

Closed
soylomass opened this issue Jun 21, 2018 · 24 comments

Comments

@soylomass
Copy link

soylomass commented Jun 21, 2018

I'm using Box2d through the gdx-box2d java library, which makes use of the c code through JNI.
I've used it without problems in my other games, serverside as they are multiplayer MMO games, but on my newest game, after a random amount of time (usually 1 or 2 days) it suddendly gets really slow until it crashes.

The game is this one (you can try it without download)

After trying to solve it java-side, I decided to start touching the c code, basically adding some printf in world.step and related functions.

b2World.cpp: https://pastebin.com/d6fn0mLd (I added printfs at the end of step displaying m_profiler times, and at different places in SolveTOI)

b2BroadPhase.h: https://pastebin.com/WTihivb1 (added prints at updatepairs showing moveCount and pairCount)


After it crashes, I analyse the log, and this is what I see:

Everything works right until suddendly it slows down, and the pairCount increases substantially.

{A}{B}{C}{D}{E1}{F}{G}{H}{I}{J}
{0||0}{}{K}{E1}{F}{G}{E2}
{PR|5.61|1.56|3.11|0.25|0.21|0.16|0.55|1.08} (milliseconds of m_profile.step|collide|solve|solveInit|solveVelocity|solvePosition|solveTOI|broadphase)
{94||194}{*} (moveCount||pairCount)
{A}{B}{C}{D}{E2}
{PR|5.05|0.99|3.60|0.21|0.18|0.20|0.42|1.10}
{13||44}{*}
{86||115}{*}
{A}{B}{C}{D}{E2}
{PR|4.71|1.07|2.95|0.19|0.18|0.20|0.40|0.97}
{14||46}{*}
{87||133}{*}
{A}{B}{C}{D}{E2}
{PR|5.92|1.17|3.82|0.23|0.24|0.24|0.59|1.31}
{110||228}{*}
{A}{B}{C}{D}{E1}{F}{G}{H}{I}{J}
{0||0}{
}{K}{E1}{F}{G}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{E2}
{PR|7.20|1.43|4.75|0.32|0.24|0.27|0.90|2.05}
{13||48}{*}
{81||115}{*}
{A}{B}{C}{D}{E1}{F}{G}{E2}
{PR|6.46|1.05|4.34|0.27|0.20|0.25|0.68|1.20}
{16||45}{*}
{97||123}{*}
{A}{B}{C}{D}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{E2}
{PR|7.12|1.63|4.48|0.14|0.21|0.15|0.82|1.79}
{99||250}{*}
{A}{B}{C}{D}{E2}
{PR|7.19|1.09|5.29|0.28|0.39|0.23|0.73|1.97}
{14||49}{*}
{90||104}{*}
{A}{B}{C}{D}{E1}{F}{G}{E1}{F}{G}{E2}
{PR|5.50|1.55|3.13|0.23|0.16|0.23|0.50|1.02}
{96||138}{*}
{A}{B}{C}{D}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{E2}
{PR|6.18|1.20|4.18|0.25|0.18|0.23|0.73|1.72}
{16||48}{*}
{95||166}{*}
{A}{B}{C}{D}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{E2}
{PR|5.97|0.99|4.13|0.19|0.19|0.20|0.54|1.40} (milliseconds of m_profile.step|collide|solve|solveInit|solveVelocity|solvePosition|solveTOI|broadphase)
{13||42}{*}
{90||24011}{*} (moveCount||pairCount)
{A}{B}{C}{D}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{E2}
{PR|18446744949882880.00|0.97|88.95|0.16|0.24|2.48|18446744949882880.00|84.54}
{11||12}{*}
{96||24120}{*}
{A}{B}{C}{D}{E2}
{PR|247.14|16.28|94.44|0.44|0.27|0.21|136.07|90.47}
{7||26}{*}
{441||951895}

...a few seconds...

{*}
{A}{B}{C}{D}

...minutes...

{E2}
{PR|18446744949882880.00|7.51|18446744949882880.00|0.38|0.16|0.13|136043.02|18446744949882880.00}

...minutes... at this time I see a lot of STUCK at colliding that come from here:

`
gameServer.getWorld().getBox2dWorld().QueryAABB(

				new QueryCallback() {

					@Override

					public boolean reportFixture(Fixture fixture) {

						if(tries.incrementAndGet() > 20){

							System.out.println("STUCK AT COLLIDING");

							return false;

						}`

then

{*}
{A}{B}{C}{D}

...minutes...

{E2}
{PR|18446744949882880.00|1133.92|18446744949882880.00|290.91|95.83|69.26|185694.27|18446744949882880.00}

CRASH
Sometimes it crashes showing some error at memmove (or something like that) method, and sometimes it doesn't show anything

A second before that this were the world stats (normal):

06-21 08:19:34 - 79 persons - 2400 entities - 1 preStep - 2401 bodies - 30 joints - ##### Physics: 6.83 (4.08/5.67/8.7) - Players: 0.08 (0.04/0.1/0.65) - Entities: 2.2
(1.97/2.84/5.7) - AI: 0.09 (0.07/0.13/0.27) - Data: 14.23 (10.79/14.6/22.03) - TOTAL: 8.74/23.34 #####

Any kind of help, even about where to continue looking for the cause is welcome. I'm hopeless right now, and the game is stuck as I don't want to continue updating or advertising it because it crashes every 1 or 2 days.

I've already checked if there were any updates on related code in current box2d master that weren't in box2d version, but there aren't.

Thanks in advance.

@soylomass
Copy link
Author

soylomass commented Jun 23, 2018

Update:

After noticing that it became slower after {D}, I added two prints inside:

for (b2Contact* c = m_contactManager.m_contactList; c; c = c->m_next)

You can see it here: https://pastebin.com/sKXA3M4q

One at the beginning and one at the end, then run the server again until it died today, these were the results:

As always, everything normal until suddendly:

{A}{B}{C}{D}{c271/1090}{E2} (times it entered to above loop / times it went till the end)
{PR|4.43|1.10|2.74|0.20|0.17|0.22|0.41|0.76}
{85||106}{*}
{A}{B}{C}{D}{c272/1090}{E2}
{PR|4.19|1.04|2.73|0.22|0.17|0.21|0.38|0.78}
{10||17}{*}
{75||109}{*}
{A}{B}{C}{D}{c272/1089}{E2}
{PR|5.18|1.14|3.29|0.26|0.21|0.24|0.47|0.99}
{98||121}{*}
{A}{B}{C}{D}{c272/1088}{E2}
{PR|5.04|1.07|3.25|0.25|0.20|0.25|0.57|1.18}
{9||14}{*}
{94||112}{*}
{A}{B}{C}{D}{c272/1093}{E2}
{PR|6.11|1.40|3.98|0.25|0.27|0.38|0.50|1.36}
{88||132}{*}
{A}{B}{C}{D}{c272/1095}{E1}{F}{G}{H}{I}{J}
{0||0}{*}{K}{c2/1095}{E2}
{PR|4.62|1.12|2.94|0.22|0.22|0.21|0.52|0.85}
{9||14}{*}
{75||46}{*}
{A}{B}{C}{D}{c269/1091}{E2}
{PR|4.77|1.31|2.83|0.22|0.22|0.21|0.38|0.74}
{97||12365}{*}
{A}{B}{C}{D}{c709/4851}{E2}
{PR|18446744949882880.00|0.99|18446744949882880.00|0.17|0.21|0.28|117.08|18446744949882880.00}{12||25}{*}
{78||12368}{*}
{A}{B}{C}{D}{c535/4850}{E2}
{PR|177.88|13.78|50.60|0.49|0.28|0.32|113.22|46.67}{48||32814}{*}
{A}{B}{C}{D}{c2349/12216}{E2}
{PR|18446744949882880.00|7.04|107.04|0.32|0.24|0.22|18446744949882880.00|103.77}
06-22 13:51:23 - 86 persons - 2054 entities - 48 preStep - 2054 bodies - 28 joints (as you see the body count is normal, and didn't increase since last check)
{28||56}{*}
{186||238393}

...some time later...

{c117972/176075}{E2} (huge contactList)
{PR|35465.07|29.95|1920.41|0.56|0.56|0.35|18446744949882880.00|1913.13}STUCK AT COLLIDING

As you see, both the m_pairCount and m_contactManager.m_contactList increase suddendly at the same time, and both continue increasing until the server crashes.

Again, any kind of help, even about where I can look for a cause, is extremely welcome. I'm desperate.

@soylomass
Copy link
Author

Could it be because box2d isn't designed for creating top-down games? Anyway, the strange thing is that it works perfectly until something happens suddenly.

@soylomass
Copy link
Author

soylomass commented Jun 23, 2018

Restarted yesterday night, and crashed again today:

{PR|2.28|0.57|1.52|0.16|0.15|0.17|0.18|0.28}
{88||95}{*}
{A}{B}{C}{D}{c105/789}{E2}
{PR|2.54|0.68|1.69|0.16|0.15|0.17|0.16|0.38}
{94||115}{*}
{A}{B}{C}{D}{c105/789}{E2}
{PR|2.59|0.65|1.76|0.15|0.15|0.17|0.18|0.36}
{10||25}{*}
{75||82}{*}
{A}{B}{C}{D}{c104/789}{E2}
{PR|2.59|0.66|1.66|0.17|0.18|0.18|0.19|0.30}
{87||98}{*}
{A}{B}{C}{D}{c104/789}{E2}
{PR|2.31|0.59|1.57|0.16|0.16|0.16|0.14|0.32}
{87||108}{*}
{A}{B}{C}{D}{c106/790}{E2}
{PR|2.42|0.61|1.63|0.15|0.14|0.16|0.17|0.34}
{90||6714}{*} (m_pairCount suddendly grows)
{A}{B}{C}{D}{c533/4081}{E2} (contactList does too)

{PR|148.26|0.89|24.05|0.17|0.18|0.35|123.24|22.18} (solveTOI takes long time)
{9||6}{*}
{75||6659}{*}
{A}{B}{C}{D}{c360/4081}{E2}
{PR|96.99|4.51|11.93|0.27|0.18|0.18|80.32|10.13}
{319||284895}{*} (huge pairCount)
{A}{B}{C}{D}

...a while after...

{c106309/200196}{E2} (huge contactList)
{PR|31171.38|2.72|18446744949882880.00|0.48|0.06|0.08|28711.93|18446744949882880.00}
06-23 05:13:30 - 41 persons - 1248 entities - 747 preStep - 1248 bodies - 13 joints (body count is even lower that yesterday)

@erincatto
Copy link
Owner

I'm guessing you have many overlapping shapes creating a quadratic explosion of contacts. I recommend logging b2ContactManager::m_contactCount. Do you have any game logic that could cause all the bodies to go to the origin? Also, if you are concerned about TOI, you can disable continuous collision to rule that out. I'm guessing it won't affect your game too much.

@soylomass
Copy link
Author

soylomass commented Jun 23, 2018

I'll monitor contactCount, bodies position and disable CCD. About the latter, turning off CCD will also turn it off for bullet bodies?

PS: Thanks for answering!! You gave me a light of hope

@erincatto
Copy link
Owner

Not sure, but it should be easy to modify the source so that only bullets use CCD.

@soylomass
Copy link
Author

The server has been running with CCD disabled for 9 days so I'm almost sure that the problem is gone.
I don't know if the problem was caused by CCD or was aggravated by it, but the game doesn't really need it so I guess it can do without it.

Do you have any idea of where the problem could be? m_contactCount is on average around 1000.

@soylomass
Copy link
Author

soylomass commented Jul 6, 2018

Well, 13 days after it finally did crash, some details:

Everything was correct:

{CC1443} m_contactCount
{PR|5.20|1.21|3.18|0.29|0.24|0.28|0.00|0.87}
{53||342}{*}
{81||236}{*}
{CC1450}
{PR|4.98|1.17|3.09|0.25|0.26|0.34|0.00|0.84}
{59||386}{*}
{101||233}{*}
{CC1454}
{PR|5.47|1.20|3.46|0.32|0.25|0.36|0.00|1.02}

Then...

{202||159026} pairCount grows
{*}
{CC46637} contactCount grows
{PR|519.05|1.20|517.63|0.26|0.22|2.08|0.00|513.41}
07-04 09:54:25 - 91 persons - 2477 entities - 21 preStep - 2477 bodies - 167 joints body count normal

As you asked me if there was any chance of bodies moving to origin, I printed the position of all bodies after this (from Java, printing the Vector2 result of body.getPosition, which calls a JNI method to the C library and contains two floats), this is what I found:

https://drive.google.com/file/d/1V6YebNSJpFMWNPXwadPCsRt8oUd-K7kx/view?usp=sharing

4 bodies with position in (0.0,0.0), 64 bodies with position (NaN,NaN)

A few seconds later:

2 bodies with position in (0.0,0.0), 104 bodies with position (NaN,NaN)

The latter continues to grow in later prints, until at the end most of the bodies are at NaN NaN, and contactCount also grows exponentially, I don't know what that means. But at the time the contact explosion happens, the bodies are basically all spread through the world, with only 4 at the origin and 64 at nan nan.

Do you have any idea of what could be the problem?

Thanks

@erincatto
Copy link
Owner

I'm guessing all the bodies at [NaN NaN] are considered overlapping. I'm guessing there is an instability in your simulation. Do you have large mass ratios between rigid bodies? You can get instabilities if connect rigid bodies together by joints and they have a large mass ratio. Anything above 10 to 1 can give you trouble. Are there any large forces in your game?

@soylomass
Copy link
Author

soylomass commented Jul 7, 2018

There are two type of joints in the game, both weld joints.

One between a "grabber" (a fishing rod's hook like thing) and fishable entities. Grabber has a mass of 6.28 and the heaviest fishable has a mass of 0.3, so there is a ratio bigger than 10 to 1, but it's the grabber the one which moves the other, is there a problem with that? Also, grabber is kinematic while fishable entities are dynamic.

The other is between rafts. Rafts have all the same mass and they can be welded to other rafts to make bigger rafts, you can see how that works looking for videos of the game on youtube.

About large forces, what is considered large? The largest forces are the ones applied on grabbers which they then apply to grabbed objects, and the one persons apply to rafts and rafts to welded rafts, but they aren't really large.

@erincatto
Copy link
Owner

The mass of a kinematic body is not used in the solver. So that mass ratio doesn't matter.

Can someone make a huge raft? How many segments? Is it possible to get overlapping and colliding raft segments that are fighting against the weld joints? How are the rafts moved? By force, impulse, setting velocity, or setting position?

Can the grabber collide with anything? How about the fishables? Applying a force to a kinematic body doesn't do anything. You should only be setting the velocity of a kinematic body. Could multiple grabbers grab the same fishable?

@soylomass
Copy link
Author

soylomass commented Jul 7, 2018

Hi:

  1. Yes, people can make huge rafts, there's no limit to the quantity of segments. Each time a raft segment is added, it's added opposite to a nearby raft and welded to the segments that surround it, up to 4 (one for each side).
    But there's a glitch actually, that happens very rarely, where rafts become "crazy" and start spinning, like you can see in this video: https://youtu.be/TEv6w1dOpxQ?t=5m8s
    I tried to replicate this bug building a hundreds segment raft, but I couldn't, so I don't know what causes it.
    The rafts are moved by applyForce

  2. About the grabber, I move it using applyImpulse. There grabber only collides with fishables, when it does it's welded to them. Fishables only collide with grabber too.
    Multiple grabbers can grab a fishable.

@erincatto
Copy link
Owner

You seem to have a couple things going on that could lead to instabilities (and thus NaNs).

1a. The best solution for raft merging is to use create multiple fixtures on a single b2Body. This removes the need for the weld joint. You will have to do some bookkeeping.

1b. If you really need to use the weld joints, then try using a negative unique collision group for all fixtures on a single raft. See b2Filter::groupIndex.

1a and 1b should both prevent the bug in the video.

  1. This can cause an instability if the weld joint is getting stretched.

Do you use a variable time step? What is the largest time step you could use? I recommend to clamp this to no larger than 1/20. (20Hz)

@soylomass
Copy link
Author

I'll try with 1b as it doesn't requires I change how the raft system work. How many different negative groupIndexes is the limit I can set? (so that different raft groups can collide with each other)
Also, would checking in preSolveCollision if both rafts belong to the same group and cancelling the contact have the same effect than setting the same neg. group index to both of them?

I'll fix 2 too.

I call world.step with a fixed timestep (world.step(3/60f, 3, 3);)

Thanks for your help

@erincatto
Copy link
Owner

The groupIndex is 16 bits, so 32K negative numbers is possible. You can change it to a 32 bit number if you like. Correct usage of b2Filter prevents the b2Contact object from being created.

You are simulating at 20Hz. This makes the solver even more sensitive to mass ratios and inconsistent constraints. Are you using a non-zero b2WeldJointDef::frequencyHz?

@soylomass
Copy link
Author

So I should run step more often?
About weld frequency, I'm using the default of 0.

@soylomass
Copy link
Author

soylomass commented Jul 23, 2018

I implemented both changes (negative group index for groups of rafts and only one grabber welding a fishable at a time) but today the server crashed again :( I thought it was fixed this time.

{CC1455}
{PR|5.72|1.53|4.14|0.31|0.29|0.30|0.00|1.51}
{53||336}{*}
{81||150}{*}
{CC1443}
{PR|5.20|1.21|3.18|0.29|0.24|0.28|0.00|0.87}
{53||342}{*}
{81||236}{*}
{CC1450}
{PR|4.98|1.17|3.09|0.25|0.26|0.34|0.00|0.84}
{59||386}{*}
{101||233}{*}
{CC1454}
{PR|5.47|1.20|3.46|0.32|0.25|0.36|0.00|1.02}
{202||159026} pairCount
{*}
{CC46637} contactCount
{PR|519.05|1.20|517.63|0.26|0.22|2.08|0.00|513.41}
07-04 09:54:25 - 91 persons - 2477 entities - 21 preStep - 2477 bodies - 167 joints
--- BODY POSITIONS ---

And the same case as before, where NaN position bodies start to grow.

I do not want to give up, because I put a lot of effort on this game, but I don't know what could be causing this.

@erincatto
Copy link
Owner

I think you have some instability causing the simulation to blow up. I recommend adding some code in b2Island.cpp to detect large positions and/or velocities. Probably in the loop at b2Island.cpp:275. You can then setup some code to call b2World::Dump. Then we can look at what the contents of the world are in the testbed.

@soylomass
Copy link
Author

soylomass commented Jul 28, 2018

I've started logging big translations and rotations, and it seems it's indeed related to that.

Just a few seconds before the contact explosion, a few off-limit rotations and translations started to appear:

{PR|2.58|0.70|1.83|0.14|0.14|0.15|0.00|0.31}
07-28 01:29:49 - 12 persons - 1239 entities - 0 preStep - 1239 bodies - 11 joints
{2||0}{*}
{MAXR:-3.36} //big rotation and it's amount
{MAXR:3.77}
{MAXT:-32.67|-14.23(p0.12|-138.60)(v-653.49|-284.50)} //big translation / position / velocity
{156||110}{*}
{CC802}
{PR|2.53|0.61|1.80|0.14|0.13|0.15|0.00|0.52}REDUCED delta time from 36.04173524
07-28 01:29:50 - 12 persons - 1239 entities - 0 preStep - 1240 bodies - 11 joints
{MAXT:-1.83|-0.80(p-32.56|-152.83)(v-36.68|-15.97)}
{13||29}{*}
{CC804}
{PR|2.34|0.72|1.61|0.13|0.14|0.29|0.00|0.22}
07-28 01:29:50 - 12 persons - 1239 entities - 0 preStep - 1240 bodies - 11 joints
{2||0}{*}
{MAXR:-50.36}
{MAXR:27.99}
{MAXT:-15.84|13.29(p-34.39|-153.62)(v-316.88|265.76)}
{30||70}{*}
{CC803}
{PR|2.29|0.65|1.60|0.15|0.17|0.18|0.00|0.22}
{2||4}{*}
{MAXR:-54.24}
{36||691}{*}
{CC1046}
{PR|3.49|0.41|3.02|0.15|0.16|0.23|0.00|1.75}
07-28 01:29:51 - 12 persons - 1238 entities - 0 preStep - 1240 bodies - 11 joints
{3||3}{*}
{MAXR:-21.03}
{MAXR:30.60}
{158||166}{*}
{CC1045}

A few seconds later, the rotations and translation grew to huge numbers:

{MAXR:-1942705.38}
{MAXR:406060.81}
{149||80}{*}
{CC780}
{PR|3.14|0.79|2.26|0.19|0.23|0.24|0.00|0.61}REDUCED delta time from 35.89000016
07-28 01:29:58 - 11 persons - 1241 entities - 0 preStep - 1241 bodies - 11 joints
{MAXR:-115650.14}
{MAXR:5874618.50}
{16||40}{*}
{CC782}
{PR|2.41|0.71|1.69|0.15|0.15|0.19|0.00|0.24}
07-28 01:29:59 - 11 persons - 1242 entities - 0 preStep - 1242 bodies - 11 joints
{3||0}{*}
{MAXT:0.84|2.54(p-1596390.75|-351134.56)(v16.77|50.78)}
{MAXR:-26006660.00}
{MAXT:-0.83|-2.40(p1596366.12|350870.78)(v-16.55|-47.91)}
{MAXR:148580064.00}
{21||44}{*}
{CC781}
{PR|2.10|0.64|1.42|0.14|0.15|0.13|0.00|0.16}
{2||0}{*}
{MAXT:46606.10|-757346.12(p14158785.00|-105139920.00)(v932122.00|-15146922.00)}
{MAXR:-40557896269824.00}
{MAXT:-46606.15|757346.31(p-14158809.00|105139656.00)(v-932123.06|15146926.00)}
{MAXR:40467811008512.00}
{44||2549}{*}
{CC1808}
{PR|15.14|0.41|14.62|0.17|0.19|6.85|0.00|6.34}
07-28 01:30:00 - 11 persons - 1241 entities - 0 preStep - 1243 bodies - 11 joints

I've also printed a few b2dump of when the max rotations and translations started appearing, you can download them here:
https://drive.google.com/file/d/1qa7AcmsbuPolZd1xohs3PAfDN1Zsc4tw/view?usp=sharing

How do I open those dumps in the testbed?

@erincatto
Copy link
Owner

Grab branch issue508 and run the testbed. I recommend hitting pause (P), then restart (R), then single step (O). I see some problems with the collision filtering. There seem to be large static regions that push everything out. Is this a problem with your collision masks?

The big problem I see for one of the dumps (I call it b2Dump02.txt) is this:

b2WeldJointDef jd;
jd.bodyA = bodies[36];
jd.bodyB = bodies[25];
jd.collideConnected = bool(0);
jd.localAnchorA.Set(5.679945600000000e+07f, -2.142136200000000e+07f);
jd.localAnchorB.Set(5.679945600000000e+07f, -2.142136200000000e+07f);

As you can see the local anchors are huge. If you create the weld joint with b2WeldJointDef::Initialize, then this means you are feeding in an anchor that is very far the from the bodies. No doubt this is causing huge instabilities.

@soylomass
Copy link
Author

Do the localAnchors change over time? Or the anchors you see there had to be set when creating the joint?

I create the joins like this:

WeldJointDef def = new WeldJointDef();
def.bodyA = jointReq.getEntity1().getBody();
def.bodyB = jointReq.getEntity2().getBody();
Vector2 anchorA = jointReq.getEntity1().getLocalPoint(jointReq.getTarget());
Vector2 anchorB = jointReq.getEntity2().getLocalPoint(jointReq.getTarget());
def.localAnchorA.set(anchorA.x, anchorA.y);
def.localAnchorB.set(anchorB.x, anchorB.y);
getBox2dWorld().createJoint(def);

The anchors be at most 1 meter away from any of the bodies, unless there's a weird bug in my code.

If you confirm that that anchor must have been set when creating the joint, I'll check in what situations that could be happening.

About the large static regions, that may be the islands, but only rafts collide with islands.

I haven't loaded the dumps in the testbed yet, I'll do as soon as I can.

@erincatto
Copy link
Owner

The local joint anchors are not modified by Box2D. I'm guessing there is a problem with jointReq.getTarget(). You could check to see if the target is ever far from bodyA or bodyB.

@soylomass
Copy link
Author

I've added a code that checks for far anchors before join creation, and it detected and corrected anchors that were far from the bodies, so I did have a problem there. But anyway, the server today crashed anyway. I increased the threshold for dump creation so only 3 dumps were made long after the server started going crazy, so it has a lot of:

bd.position.Set(nanf, nanf);
bd.angle = nanf;

And the testbed can't read them.

I opened the issue508 testbed and about the bodies being pushed out of the islands, they are the humans/animals, they can collide with islands but the contacts are disabled on the collision callbacks.

I guess the problem might indeed be related to rafts, as sometimes the MAXT (big translation) messages start after joining rafts. I should implement the solution you said before of adding additional rafts as fixtures instead of joining bodies and see if the bug keeps happening. That's the only thing I think is left to try now.

@erincatto
Copy link
Owner

Any more on this? Otherwise I will close this soon.

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

No branches or pull requests

2 participants