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

Improve error message thrown when cached queries are created while world is in readonly mode #1508

Open
Indra-db opened this issue Jan 8, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@Indra-db
Copy link
Contributor

Indra-db commented Jan 8, 2025

see related issue in rust:
Indra-db/Flecs-Rust#220

To Reproduce

void bar(flecs::world& world) {
    auto q = world.query_builder<>()
        .with<Foo>(flecs::Wildcard)
        .group_by<Foo>()
        .build();

    q.run([](flecs::iter& it) {});
}

void test_crashd() {
    flecs::world world;

    world.system<>("").run([&](flecs::iter& it) {
        bar(world);
    });

    world.progress();
}
[](fatal: flecs.c: 40045: assert: !(world->flags & EcsWorldReadonly) INTERNAL_ERROR)](fatal: flecs.c: 40045: assert: !(world->flags & EcsWorldReadonly) INTERNAL_ERROR)
@Indra-db Indra-db added the bug Something isn't working label Jan 8, 2025
@SanderMertens SanderMertens added enhancement New feature or request and removed bug Something isn't working labels Jan 8, 2025
@SanderMertens
Copy link
Owner

This happens because creating a grouped query makes it cached, and cached queries can't be created from systems that are not immediate since they require mutating the world, and the world will be in readonly mode.

This should not be reported as INTERNAL_ERROR though, will take a look at improving that.

@SanderMertens SanderMertens changed the title Queries produced by iterators that are grouped by a relation causes crash Improve error message thrown when cached queries are created while world is in readonly mode Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants