Core Validation Fails - Multi Threading & Python 3.11
jhanm12 opened this issue · comments
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
- This issue is reproduced in a multi threading process with 2 or more threads doing the validation in a parallel process.
- It passes via a single instance.
- 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>'
@Grokzen Can you please help here? Please, let me know if you need more details.