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

OpenOpcService crashes if I try to read TAGs values #56

Open
danilNil opened this issue Aug 17, 2023 · 5 comments
Open

OpenOpcService crashes if I try to read TAGs values #56

danilNil opened this issue Aug 17, 2023 · 5 comments

Comments

@danilNil
Copy link

Hi!

I have two questions:

  1. What did I do wrong in reading tag values? Could it be a Matrikon.OPC.Simulation configuration or limitations?
  2. How do you handle OpenOpcService crashes in production if you need to read tag values with high performance (up to 10,000 values per second)?

Here is my environment:

OPC DA Server

  • Windows Server 2016 Standart 64 bit
  • Python 3.10.11 - 64 bit
  • gbda_aut.dll - 64 bit
  • Matrikon.OPC.Simulation
  • openopc2service

OPC DA Client

  • MacOS with Python 3.10.12
  • openopc2

I ran this code https://github.com/iterativ/openopc2/blob/develop/examples/connect_discover_read_tags.py and got following output:

Attempting Connection to Matrikon.OPC.Simulation
Connecting in Gateway Mode
[('Protocol', 'com'), ('Class', 'Graybox.OPC.DAWrapper'), ('Client Name', ''), ('OPC Host', 'WWServer'), ('OPC Server', 'Matrikon.OPC.Simulation'), ('State', 'Running'), ('Version', '1.9 (Build8629)'), ('Browser', 'Hierarchical'), ('Start Time', '2023-08-11 10:20:30.676000+00:00'), ('Current Time', '2023-08-17 06:07:07.103000+00:00'), ('Vendor', 'Matrikon Inc +1-780-945-4011 http:https://www.matrikonopc.com')]
Connected to Matrikon.OPC.Simulation
TAGS:
  0 #MonitorACLFile
  1 Bucket Brigade.ArrayOfReal8
  2 Bucket Brigade.ArrayOfString
  3 Bucket Brigade.Boolean
  4 Bucket Brigade.Int1
  5 Bucket Brigade.Int2
  6 Bucket Brigade.Int4
  7 Bucket Brigade.Money
  8 Bucket Brigade.Real4
  9 Bucket Brigade.Real8
READ:
Traceback (most recent call last):
  File "/Users/danilnikiforov/PycharmProjects/venv/hightechplant-mes/lib/python3.10/site-packages/Pyro5/socketutil.py", line 132, in receive_data
    chunk = sock.recv(size, socket.MSG_WAITALL)
ConnectionResetError: [Errno 54] Connection reset by peer

After I tried to read TAG values OpenOpcService crashed with following error from gbda_aut.dll:

Faulting application name: OpenOpcService.exe, version: 0.0.0.0, time stamp: 0x63861178
Faulting module name: gbda_aut.dll, version: 1.0.8.304, time stamp: 0x4d92bcca
Exception code: 0xc0000005
Fault offset: 0x000000000001b966
Faulting process id: 0x3154
Faulting application start time: 0x01d9d04f9bf6925f
Faulting application path: C:\Program Files\OpenOpcService.exe
Faulting module path: C:\Windows\system32\gbda_aut.dll
Report Id: fe95e420-6e07-42b4-b74a-88ffbac523b4
Faulting package full name: 
Faulting package-relative application ID: 
@renzop
Copy link
Collaborator

renzop commented Aug 17, 2023

We tested on a 32 bit setup (Win 64bit, but 32 bit Python) due to legacy stuff from the old open opc library. It is on our todo list to migrate everything to 64bit only... So Try 32 bit first.

You can also start the Gateway server in your python environment (gateway_server.py) instead of running the Service... this makes it easier to debug.

About the 10000 Tags per second... I think that is a bit much, but never tried it. Would be interesting to hear your results. When you want to achieve higher perfomance make sure that you use groups when reading and play arounod with the sync option. I think it also highly depends on the OPC server that you are using.

@danilNil
Copy link
Author

danilNil commented Aug 21, 2023

@renzop thanks for pointing out that 32-bits works better. I've changed gbda_aut.dll to 32-bit and run gateway_server.py under a 32-bit Python environment.

If I have the gbda_aut.dll 32-bit installed, then I cannot even connect to the gateway with the following error:

OPCError: (OPCError(...), 'Dispatch: (-2147024770, \'The specified module could not be found.\', None, None) opc_class:"Graybox.OPC.DAWrapper"')

So, I've installed gbda_aut.dll 64-bit and run gateway_server. It still crashes after I've tried to read tags. So, I traced the place where it crashed by using trace:

python -u -m trace -t gateway_server.py

Here's what I've got:

 --- modulename: __init__, funcname: _get_good_single_object_
__init__.py(606):     if _PyIDispatchType == type(obj):
__init__.py(608):     return obj
da_client.py(369):                     tags = tag_groups[gid]
da_client.py(371):                     valid_tags, server_handles = add_items(tags)
 --- modulename: da_client, funcname: add_items
da_client.py(203):             names = list(tags)
da_client.py(205):             names.insert(0, 0)
da_client.py(206):             errors = []
da_client.py(208):             if self.trace:
da_client.py(211):             try:
da_client.py(212):                 errors = opc_items.Validate(len(names) - 1, names)
 --- modulename: 341A7851-5DEA-4022-B0D6-F9954AF9273Dx0x1x0, funcname: Validate
341A7851-5DEA-4022-B0D6-F9954AF9273Dx0x1x0.py(710):             return self._ApplyTypes_(1610743822, 1, (24, 0), ((3, 1), (24584, 1), (24579, 2), (12, 17), (12, 17)), 'Validate', None,NumItems
341A7851-5DEA-4022-B0D6-F9954AF9273Dx0x1x0.py(711):                     , ItemIDs, Errors, RequestedDataTypes, AccessPaths)
341A7851-5DEA-4022-B0D6-F9954AF9273Dx0x1x0.py(710):             return self._ApplyTypes_(1610743822, 1, (24, 0), ((3, 1), (24584, 1), (24579, 2), (12, 17), (12, 17)), 'Validate', None,NumItems
 --- modulename: __init__, funcname: _ApplyTypes_
__init__.py(571):         return self._get_good_object_(
__init__.py(572):             self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
  1. Do you know what might be causing this error and how to solve it?
  2. I'm wondering why the 32 bit version of gbda_aut.dll isn't functioning.

@renzop
Copy link
Collaborator

renzop commented Aug 22, 2023

I can reproduce the error, but it works for some tags... At the moment I am too busy to work on this.

@danilNil
Copy link
Author

@renzop thanks for the insight about some tags! I will investigate more.

@LoricAndre
Copy link

LoricAndre commented Feb 9, 2024

Any progress on this ? I am having the same issue (service executable running on windows, client on linux)

Edit : registering the 64bit dll on the windows gateway makes this error disappear

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

3 participants