Skip to content

fix: infinite loop with jsonschema>3.2.0 #173

Closed

Description

@athith-g

Describe the bug
Starting proTES fails with jsonschema versions > 3.2.0. This is due to the tesNextTes schema in pro_tes/api/additional_logs.yaml referencing itself, causing an infinite loop during validation or reference resolution (I'm not sure which).

To Reproduce
Steps to reproduce the behavior (in local python virtual environment):

  1. pip install -r requirements.txt
  2. pip install jsonschema==4.22.0
  3. cd pro_tes
  4. python3 app.py

Result
Server gets stuck here:
Screenshot 2024-05-17 at 10 31 47 AM

Expected behavior
Server should continue with setup process.

Workarounds

  1. Use jsonschema version 3.2.0 (pip install jsonschema==3.2.0) OR
  2. Comment out forwarded_to property in tesNextTes OR
  3. Use oneOf:
    forwarded_to:
       oneOf:
           - $ref: '#/components/schemas/tesNextTes'

Possible solutions

  1. Specify jsonschema version in requirements.txt
  2. Alter additional_logs.yaml to avoid infinite loop

Activity

  1. changed the title [-]bug: infinite loop with jsonschema>3.2.0[/-] [+]fix: infinite loop with jsonschema>3.2.0[/+] on May 17, 2024
  2. uniqueg commented on May 18, 2024

    @uniqueg
    Member

    Nice catch, thanks a lot!

    So we do need the forwarded_to property in order to keep track of the service that the TES requests ends up on eventually. And we also need to support multiple services in the chain, in case more than one gateway is involved.

    But probably we could get away with a non-recursive solution, and luckily we can easily change that, given that it's not part of the TES specs but something we added ourselves. My suggestion would be to make tesNextTes an array of (a new model) tesForward with properties id, url and - to be on the safe side in case we cannot rely on ordering - a forward_time (use the same format as described in this comment. But remove the recursive forwarded_to reference.

    This solution should work fine for use cases where forwarding is strictly linear. This assumption may not be warranted for all use cases, but as far as I know, we hadn't yet had a reason to forward an incoming task to multiple services (and anyway proTES doesn't currently support that).

  3. uniqueg commented on Oct 22, 2026

    @uniqueg
    Member

    This is part of the FOCA upgrade in #203: FOCA 0.15 requires jsonschema 4, so the recursive tesNextTes schema has to go. We'll do it as suggested above: forwarded_to becomes a non-recursive list of forwards with id, url and forward_time (a breaking change of this proTES extension, noted in the release notes). The PR for #203 will close this issue.

  4. added a commit that references this issue on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions