Docker + Windows + PyTango: Access violation - no RTTI data!

I have Windows 10 64x. I have run the container from this page from "Tango docker stack for Tango REST API" section: https://tango-controls.readthedocs.io/en/latest/development/debugging-and-testing/testing-tango-using-docker.html
I also installed Tango on my Windows system. I created a device in POGO in Python, added a scalar attribute and a command which does nothing. I start the abovementioned Docker containers. In Jive I want to add a server in the Server Wizard, give a server and an instance name. Then I try to run the python file by either typing in console "python WaterContainer.py WaterContainer" (WaterContainer is both is the name for the device and the server) or by running the file in PyCharm. In both cases I get the following message:

C:\Users\papho\.conda\envs\myenv\python.exe D:/Mediso/TangoWin/WaterContainer/WaterContainer.py WaterContainer
PyDS: WaterContainer: An error occured in the constructor:
Access violation - no RTTI data!

Process finished with exit code -1073741819 (0xC0000005)

I didn't manage to find in the Internet what can be the reason and I don't understand it by myself as well. Do you know what can be the cause of it?
And actually I am not sure about how to use Docker containers with Tango. How do I actually create a device and run it?
Hi GTLeet

It looks like you might have PyTango 9.3.2 installed on your Windows system. Unfortunately this version is broken on Windows!
For now, the best option is to use the previous version, 9.3.1. Installed with a command like python -m pip install -U pytango==9.3.1. There are some details here, https://github.com/tango-controls/pytango/issues/368 - I see it doesn't come up in a general Internet search.

We have recently (yesterday) merged in a fix for the Windows issues, so hope to have a new release soon.

On the more general question about Docker. The setup you are trying has the MySQL database and the Tango DatabaseDS running in Docker containers. Your application, WaterContainer, is running on your host OS. Once the Docker compose stack is running, you will still need to set TANGO_HOST=localhost:10000 in your Windows environment variables.

Other than that, it looks like you are following a reasonable approach.

Regards,
Anton
Hello Anton

Thank you very much for the explanation! Everything works now.

Best regards,
Egor
Well, it turned out that not everything works. If I create a device server, I can use this device in Jive, use the commands created, but in the REST API part I have this:



So I don't see any devices.
Edited 3 years ago
Hi Egor

I don't know much about using the REST server, but I'll try to help.

I also see an empty dict for the /hosts endpoint. However, I am able to access the running devices, with a URL like this, where I've used "tango-cs/10000" as the host.

http://localhost:10001/tango/rest/rc4/hosts/tango-cs/10000/devices/sys/tg_test/1/attributes/double_scalar/value

Returns:
{"name":"double_scalar","value":-247.27676244894118,"quality":"ATTR_VALID","timestamp":1608277788179}

After doing that:
http://localhost:10001/tango/rest/rc4/hosts
Returns:
{"tango-cs:10000":"http://localhost:10001/tango/rest/rc4/hosts/tango-cs/10000"}

I don't know why /hosts is empty initially.

Looking at the Wiki, https://github.com/tango-controls/rest-server/wiki, indicates that we need to register the TangoRestServer in the database. I'm not sure if you can register it from Jive, since it runs in the tango-rest Docker container, while Jive is running on your host (Windows) machine. However, we can do it from within the Docker container running the DatabaseDS. First we need to find the container:


(host)$ docker ps | grep tango-cs
f915c13ee973 tangocs/tango-cs:9 "/bin/sh -c '/usr/lo…" 2 days ago Up 15 minutes 0.0.0.0:10000->10000/tcp docker-test_tango-cs_1


In my case, the container name is docker-test_tango-cs_1.
Next, run tango_admin command in the container to register the device:

(host)$ docker exec docker-test_tango-cs_1 tango_admin –add-server TangoRestServer/test TangoRestServer sys/rest/0


I'm not sure if the registration is necessary, since the REST server seems to be working fine without registration.

Regards,
Anton
Hi,

GTLeet
So I don't see any devices.

Here are my 50 cents. You see an empty output as by design rest-server does not provide a list of tango hosts. This is due to absence of a discovery protocol in Tango Controls on a hosts level. So clients HAVE to provide a desired tango host in advance e.g.


GET …/hosts/localhost;port=10000


Concerning registering TangoRestServer in the Tango DB - it is not required since version 2.0. Alas it is not yet dockerized, but that is pretty straightforward, as rest-server does not require any Tango environment anymore you can just take any Java Server e.g. Apache Tomcat based docker and drop the .war file into the root (webapps in case of Apache Tomcat)

Hope this helps

MC&HNY

Cheers,
 
Register or login to create to post a reply.