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

bug: Adding a schema within a repository followed by other imports could result in failures due to timing issues #5051

Closed
ogenstad opened this issue Nov 26, 2024 · 1 comment
Assignees
Labels
group/backend Issue related to the backend (API Server, Git Agent) priority/1 This issue must be fixed/implemented ASAP, it's a blocker for a release type/bug Something isn't working as expected

Comments

@ogenstad
Copy link
Contributor

Component

Git Integration

Infrahub version

v1.1.0b1

Current Behavior

When importing a repository that includes a schema along with other objects such as GraphQL queries, transforms / generators there's a chance that a timing issue causes problems for the objects created after the schema has loaded.

This is because when calling the method below to load the schema we don't wait for the schema to converge after moving forward with the other imports.

class InfrahubRepository(InfrahubRepositoryIntegrator):


    async def import_schema_files(self, branch_name: str, commit: str, config_file: InfrahubRepositoryConfig) -> None:
        response = await self.sdk.schema.load(schemas=[item.content for item in schemas_data], branch=branch_name)

The result could potentially be that when we try to import a GraphQL query the request hits one of the HTTP workers where the schema hasn't yet been updated which would result to an error due to an invalid GraphQL query (since the new nodes might not yet exist)

Expected Behavior

The schema importer needs to wait until the schema has converged across all active workers before continuing.

Steps to Reproduce

I have not seen this error myself but thinking about it it seems reasonable that it could lead to an error. As such it might be hard to reproduce. It would involve adding a fairly large schema (that might take some time to load on the secondary workers) and then import a few objects directly after this. There is of course a chance that the request hits the same worker as the one that processed the schema (where it is already updated)

Additional Information

No response

@ogenstad ogenstad added type/bug Something isn't working as expected group/backend Issue related to the backend (API Server, Git Agent) labels Nov 26, 2024
@exalate-issue-sync exalate-issue-sync bot added priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release priority/1 This issue must be fixed/implemented ASAP, it's a blocker for a release and removed priority/2 This issue stalls work on the project or its dependents, it's a blocker for a release labels Nov 26, 2024
@dgarros dgarros added this to the Infrahub - 1.0.x milestone Nov 27, 2024
@ogenstad
Copy link
Contributor Author

Fixed in #5065.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) priority/1 This issue must be fixed/implemented ASAP, it's a blocker for a release type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants