-
Notifications
You must be signed in to change notification settings - Fork 122
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
Problem decoding response from invalid get on v23.X #2023
Comments
SummarySituationThis due to an MAPDL bug where an invalid field 5 or more returns a weird message:
This bug gets rendered in the gRPC differently (probably because of the write to the file using
These weird characters provoke the error when parsing the message: =================================== FAILURES ===================================
_______________________________ test_invalid_get _______________________________
mapdl = <ansys.mapdl.core.mapdl_grpc.MapdlGrpc object at 0x7fc8bf26fd30>
def test_invalid_get(mapdl):
with pytest.raises((MapdlRuntimeError, MapdlCommandIgnoredError)):
> mapdl.get_value("ACTIVE", item1="SET", it1num="invalid")
tests/test_grpc.py:116:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/ansys/mapdl/core/mapdl.py:2434: in get_value
return self._get(
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/ansys/mapdl/core/errors.py:153: in wrapper
out = func(*args, **kwargs)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/ansys/mapdl/core/mapdl_grpc.py:2016: in _get
out = self.run("*GET,__temp__," + cmd)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/ansys/mapdl/core/mapdl.py:3062: in run
text = self._run(command, verbose=verbose, mute=mute)
/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/ansys/mapdl/core/mapdl_grpc.py:930: in _run
response = self._send_command(cmd, mute=mute)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<ansys.mapdl.core.mapdl_grpc.MapdlGrpc object at 0x7fc8bf26fd30>, '*GET,__temp__,ACTIVE,,SET,invalid,,,, , ,')
kwargs = {'mute': False}, old_handler = <function handler at 0x7fc8c522edc0>
class_name = 'MapdlGrpc'
mapdl = <ansys.mapdl.core.mapdl_grpc.MapdlGrpc object at 0x7fc8bf26fd30>
@wraps(func)
def wrapper(*args, **kwargs):
"""Capture gRPC exceptions and KeyboardInterrupt"""
# capture KeyboardInterrupt
old_handler = None
if threading.current_thread().__class__.__name__ == "_MainThread":
if threading.current_thread().is_alive():
old_handler = signal.signal(signal.SIGINT, handler)
# Capture gRPC exceptions
try:
out = func(*args, **kwargs)
except (_InactiveRpcError, _MultiThreadedRendezvous) as error:
# can't use isinstance here due to circular imports
try:
class_name = args[0].__class__.__name__
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/grpc/_common.py", line 90, in _transform
return transformer(message)
google.protobuf.message.DecodeError: Error parsing message with type 'ansys.api.mapdl.v0.CmdResponse'
----------------------------- Captured stderr call -----------------------------
[libprotobuf ERROR google/protobuf/wire_format_lite.cc:618] String field 'ansys.api.mapdl.v0.CmdResponse.response' contains invalid UTF-8 data when parsing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.
------------------------------ Captured log call -------------------------------
ERROR grpc._common:_common.py:92 Exception deserializing message!
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/grpc/_common.py", line 90, in _transform
return transformer(message)
google.protobuf.message.DecodeError: Error parsing message with type 'ansys.api.mapdl.v0.CmdResponse'
----------------------------- Captured stderr call -----------------------------
[libprotobuf ERROR google/protobuf/wire_format_lite.cc:618] String field 'ansys.api.mapdl.v0.CmdResponse.response' contains invalid UTF-8 data when parsing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.
------------------------------ Captured log call -------------------------------
ERROR grpc._common:_common.py:92 Exception deserializing message!
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/grpc/_common.py", line 90, in _transform
return transformer(message)
google.protobuf.message.DecodeError: Error parsing message with type 'ansys.api.mapdl.v0.CmdResponse'
----------------------------- Captured stderr call -----------------------------
[libprotobuf ERROR google/protobuf/wire_format_lite.cc:618] String field 'ansys.api.mapdl.v0.CmdResponse.response' contains invalid UTF-8 data when parsing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.
------------------------------ Captured log call -------------------------------
ERROR grpc._common:_common.py:92 Exception deserializing message!
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/grpc/_common.py", line 90, in _transform
return transformer(message)
google.protobuf.message.DecodeError: Error parsing message with type 'ansys.api.mapdl.v0.CmdResponse' The error is later confirmed by some server side output:
ApproachThe approach now is to file a bug with the MAPDL team and mark the test as expected to fail. Also add another test which fail without that bug (invalid field less than 5) This is implemented in the PR we discovered #1912 |
We can close this issue, because this needs to be addressed in the MAPDL team (and I think it has been) and we have the tests in place. |
The text was updated successfully, but these errors were encountered: