Automation: gRPC error in manager init

I wrote some python code to perform automatic measurements and analysis via Logic 2. On two different PCs it’s running just fine, on a third one I can’t get it to work. For the exact error which is showing up (grpc_message:“Stream removed”), please see the attached file (the “…” is a path on the local machine, which I removed for sharing the traceback).

I’m using these versions:

  • Logic 2.4.10
  • Python 3.9.5
  • Python package logic2-automation 1.0.6
  • Python package grpcio 1.59.2
  • Python package protobuf 4.24.4
  • Python package pywin32 306

One of the other PCs, which the script successfully runs on, has the exact same versions installed.
I already tried reinstalling python and Logic2, but it didn’t change anything.

Any ideas on what might cause this issue?

logic_2_grpc_error_stream_removed.txt (1.9 KB)

Hi @luca.schaaf ,

This looks like a grpc/networking issue. A few questions and things to try:

  1. Is there anything different about the networking setup on the machine that is failing? Any other notable differences?
  2. Can you share the full script that you are running?
  3. To confirm, you are running Logic 2 with the automation server enabled, on the same machine that you are running your python script?
  4. GRPC has 2 environment variables you can set that might provide more insight into what is happening. The env variables are documented at https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. I would try GRPC_VERBOSITY=debug and start with GRPC_TRACE=http,http2_stream_state. There are other GRPC_TRACE tracers listed at https://github.com/grpc/grpc/blob/master/doc/environment_variables.md.

I can help take a look at the output from the GRPC logging if you post it here (or shoot me a DM).

Ryan

Hello Ryan,

thank you for your response. Please see my answers below:

  1. To my knowledge the network setup is not different. All three devices are managed by the same company system and the only settings I did was to set the http_proxy and https_proxy on the affected machine since it was not set initially (but is set on the other machines, I needed it for installing packages via pip). I didn’t notice any other differences between the machines, on none of them gRPC is used otherwise.
  2. I will send you a DM with the script attached.
  3. The automation server is enabled inside Logic 2.
  4. I ran the script again with the settings you mentioned. Sadly, I can’t upload the resulting log file here for some reason. I’ll try to include it in the DM as well.

Best regards
Luca

Solved
@huffman Thank you very much again for figuring this out!

Solution:
Disabling the gRPC proxy usage (can i.e. be done using python):

with automation.Manager.connect(..., grpc_channel_arguments=[("grpc.enable_http_proxy", 0)]) as manager:

Potential root cause:
Despite all three machines used being administrated the same way, the environment variables http_proxy and https_proxy initially weren’t set on the machine with the issue, but they were set on the other two machines (on which the issue didn’t occur). I had to set the environment variables before being able to run the python script, since I needed them to install packages (i.ei logic2-automation) via pip.
It seems like there probably is a difference in the network configuration of these machines, which caused the need to set the environment variables and also the issue described in the post above.