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

Core Validation Fails - Multi Threading & Python 3.11 #200

Open
jhanm12 opened this issue Mar 8, 2024 · 1 comment
Open

Core Validation Fails - Multi Threading & Python 3.11 #200

jhanm12 opened this issue Mar 8, 2024 · 1 comment

Comments

@jhanm12
Copy link

jhanm12 commented Mar 8, 2024

Environment

  • Python version: 3.11.4 (Wanted to check, if you would be able to provide support to this version as well?)
  • PyKwalify version: 1.8.0

Steps to Reproduce

  1. This issue is reproduced in a multi threading process with 2 or more threads doing the validation in a parallel process.
  2. It passes via a single instance.
  3. It also passes, if we check it via pdb in a multi threaded processes.

Schema

For any Yaml Schema.

Data

For any Json Data.

Expected Behavior

It is expected to pass via multi threading case as well. (Earlier, with Python 3.6.7 & PyKwalify 1.5.2 - It works fine.)

Observed Behavior

It randomly passes on some threads & fails on the rest.

-Error----2024-02-28T09-59-33.948[Interface-Creation-f3a-r1-pod17][HealthCheckAndRecovery]> Exception Occured during Interface Breakout on router f3a-r1-pod17: while parsing a block node
expected the node content, but found '<stream start>'
  in "None", line 1, column 1
Traceback (most recent call last):
  File "/auto/cafy/CaReS-2/scripts/pod_health_check_and_recovery.py", line 293, in interfaces_creation_and_unshut
    optics_object = Optics(device=router, mode='cli', name="optics")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/infra_framework/cafykit/lib/feature_lib/__init__.py", line 896, in __new__
    trunner = klass(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_spitfire_thinxr_cli.py", line 20, in __init__
    super().__init__(device, *args, **kwargs)
  File "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_thinxr_cli.py", line 22, in __init__
    super().__init__(device, *args, **kwargs)
  File "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_xr_cli.py", line 31, in __init__
    super().__init__(device, *args, **kwargs)
  File "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_base.py", line 34, in __init__
    Core(source_file=os.path.join(os.path.dirname(__file__), 'optics.json'), schema_files=[os.path.join(os.path.dirname(__file__), 'optics_schema.yaml')]).validate(raise_exception=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/pykwalify/core.py", line 118, in __init__
    data = yml.load(stream)
           ^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/main.py", line 451, in load
    return constructor.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/constructor.py", line 114, in get_single_data
    node = self.composer.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 72, in get_single_node
    document = self.compose_document()
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 130, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 211, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 130, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 211, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 130, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 211, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 130, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 211, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 106, in compose_node
    if self.parser.check_event(AliasEvent):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 639, in parse_block_mapping_value
    return self.parse_block_node_or_indentless_sequence()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 355, in parse_block_node_or_indentless_sequence
    return self.parse_node(block=True, indentless_sequence=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 516, in parse_node
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a block node
expected the node content, but found '<stream start>'
  in "None", line 1, column 1
File "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_base.py", line 34, in __init__
    Core(source_file=os.path.join(os.path.dirname(__file__), 'optics.json'), schema_files=[os.path.join(os.path.dirname(__file__), 'optics_schema.yaml')]).validate(raise_exception=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/pykwalify/core.py", line 118, in __init__
    data = yml.load(stream)
           ^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/main.py", line 451, in load
    return constructor.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/constructor.py", line 114, in get_single_data
    node = self.composer.get_single_node()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 67, in get_single_node
    self.parser.get_event()
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 161, in get_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 678, in parse_flow_sequence_entry
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a flow sequence
  in "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_schema.yaml", line 37, column 15
expected ',' or ']', but got '<scalar>'
 File "/auto/cafy/release/24.08.11/rhel8-24.08.11/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 614, in parse_block_mapping_key
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a block mapping
  in "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_schema.yaml", line 20, column 7
expected <block end>, but found '<block mapping start>'
  in "/auto/cafy/infra_framework/cafykit/lib/hw/optics/optics_schema.yaml", line 86, column 9
-Error----2024-02-28T09-59-33.948[Interface-Creation-f3a-r1-pod17][HealthCheckAndRecovery]> Exception Occured during Interface Breakout on router f3a-r1-pod17: while parsing a block node
expected the node content, but found '<stream start>'
@jhanm12
Copy link
Author

jhanm12 commented Mar 8, 2024

@Grokzen Can you please help here? Please, let me know if you need more details.

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

No branches or pull requests

1 participant