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

Stack overflow with two acyclic relations in opposite directions #714

Open
bbdb68 opened this issue May 4, 2022 · 4 comments
Open

Stack overflow with two acyclic relations in opposite directions #714

bbdb68 opened this issue May 4, 2022 · 4 comments
Labels
bug Something isn't working will take a while This will take a while

Comments

@bbdb68
Copy link

bbdb68 commented May 4, 2022

I created an acyclic relation, and use is with child of, but in reverse order:

flecs::world world;
  flecs::entity relation = world.entity("relation").add(flecs::Acyclic);

  auto a = world.entity("a");
  auto b = world.entity("b");
  a.child_of(b);
  b.add(relation, a);

this made my code crash with stack overflow
Looks like my custom relation interferes with child_of, but I do not understand why

@bbdb68 bbdb68 added the bug Something isn't working label May 4, 2022
@SanderMertens
Copy link
Owner

Got it reproduced, it's a bug in the notification code. I'm currently doing a refactor of that code, will make sure this gets fixed as part of that.

@bbdb68
Copy link
Author

bbdb68 commented May 4, 2022

great, thanks

@SanderMertens SanderMertens changed the title stack overflow with relation Stack overflow with two acyclic relations in opposite directions May 4, 2022
@RicardRC
Copy link

I get the same with Transitive.
Somehow in my full code I triggered it with Exclusive too, but can't manage to trigger with exclusive on a minimum repro case.

#include "flecs.h"

struct ownedBy {};

int main()
{
	flecs::world universe;
	universe.component<ownedBy>().add(flecs::Transitive);
	//universe.component<ownedBy>().add(flecs::Acyclic);	// Also breaks

	auto woodGolemLeader = universe.entity();

	auto woodGolemCoreStation = universe.entity().add<ownedBy>(woodGolemLeader);

	woodGolemLeader.child_of(woodGolemCoreStation);
}

@SanderMertens
Copy link
Owner

This will take a bit longer to fix, I completed the refactor but it still had a few performance issues that will take some time to work through.

@RicardRC makes sense that this would also trigger with Transitive, adding Transitive automatically adds Acyclic.

@SanderMertens SanderMertens added the will take a while This will take a while label Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working will take a while This will take a while
Projects
None yet
Development

No branches or pull requests

3 participants