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

ZB misses ctypes exception: File "_ctypes/callbacks.c", line 234, in 'calling callback function' #38

Open
jtlz2 opened this issue Mar 26, 2018 · 1 comment

Comments

@jtlz2
Copy link

jtlz2 commented Mar 26, 2018

I've managed to get ctypes to throw an exception, but it's not trapped by ZB (should it be?):

(1522065500.92/c17f30d6) WINE o: {'d': 0, 'f': [], 'g': 2, 'n': None, 'p': False, 's': True, 't': 'c_byte'}
(1522065500.92/c17f30d6) UNIX o: [routine-client] ... configured. Proceeding ...
(1522065500.92/c17f30d6) UNIX o: [routine-client] ... parameters are "(<main.A object at 0x10443cb70>, <main.B object at 0x1044106a8>, <main.C object at 0x1044109d8>)". Packing and pushing to server ...
(1522065500.92/c17f30d6) WINE o: [routine-server] Trying call routine "func" ...
(1522065500.92/c17f30d6) WINE o: [callback-server] Trying to call callback routine "func_104cf9048" ...
(1522065500.92/c17f30d6) WINE o: [callback-server] ... parameters are "(None, 1363236)". Packing and pushing to client ...
(1522065500.92/c17f30d6) UNIX o: [callback-client] Trying to call callback routine "func_104cf9048" ...
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 234, in 'calling callback function'
TypeError: init expected at most 1 arguments, got 2
(1522065500.92/c17f30d6) UNIX o: [callback-client] ... done.
(1522065500.92/c17f30d6) WINE o: [callback-server] ... received feedback from client, unpacking ...
(1522065500.92/c17f30d6) WINE o: [callback-server] ... unpacked, return.
(1522065500.92/c17f30d6) WINE o: [routine-server] ... failed!
(1522065500.92/c17f30d6) WINE e: Traceback (most recent call last):
(1522065500.92/c17f30d6) WINE e: File "Z:\usr\local\lib\python3.6\site-packages\zugbruecke\core\routine_server.py", line 95, in call
(1522065500.92/c17f30d6) WINE e: return_value = self.handler(*tuple(args_list))
(1522065500.92/c17f30d6) WINE e: OSError: exception: access violation reading 0x00000008
(1522065500.92/c17f30d6) UNIX o: [routine-client] ... received feedback from server, unpacking & syncing arguments ...
Traceback (most recent call last):
File "./func.py", line 1329, in
ret=main()
File "./func.py", line 1153, in main
status=func(a,b,c)
File "/usr/local/lib/python3.6/site-packages/zugbruecke/core/routine_client.py", line 129, in call
self.data.arg_list_unpack(return_dict['args'], self.argtypes_d),
File "/usr/local/lib/python3.6/site-packages/zugbruecke/core/data/contents.py", line 75, in arg_list_unpack
return [self.unpack_item(a[1], d) for a, d in zip(args_package_list, argtypes_list)]
File "/usr/local/lib/python3.6/site-packages/zugbruecke/core/data/contents.py", line 75, in
return [self.unpack_item(a[1], d) for a, d in zip(args_package_list, argtypes_list)]
File "/usr/local/lib/python3.6/site-packages/zugbruecke/core/data/contents.py", line 345, in unpack_item
arg_rebuilt = self.unpack_item_struct(arg_raw, arg_def_dict)
File "/usr/local/lib/python3.6/site-packages/zugbruecke/core/data/contents.py", line 467, in unpack_item_struct
self.unpack_item(field_arg[1], field_def_dict) # parameter value
TypeError: expected FunctionType instance, got NoneType
(1522065500.93/c17f30d6) UNIX o: [session-client] TERMINATING ...
(1522065500.93/c17f30d6) UNIX o: [session-client] Waiting for session-server be down ...
(1522065500.93/c17f30d6) UNIX o: [session-client] ... session server is down (after 0.00 seconds).
(1522065500.93/c17f30d6) WINE o: [mp-server] TERMINATING ...
(1522065500.93/c17f30d6) WINE o: [session-server] TERMINATING ...
(1522065500.93/c17f30d6) WINE o: [session-server] TERMINATED.
(1522065500.93/c17f30d6) WINE o: [mp-server] TERMINATED.
(1522065500.93/c17f30d6) UNIX o: [interpreter] TERMINATING ...
(1522065500.93/c17f30d6) UNIX o: [interpreter] Joining logging thread "out" ...
(1522065501.93/c17f30d6) UNIX o: [interpreter] Joining logging thread "err" ...
(1522065502.93/c17f30d6) UNIX o: [interpreter] Logging threads joined or timed out.
(1522065502.93/c17f30d6) UNIX o: [interpreter] TERMINATED.
(1522065502.93/c17f30d6) UNIX o: [session-client] TERMINATED.

The reason for the mismatch in the number of arguments was to persuade the callback function G (see #35) not to crash ZB earlier.

@s-m-e
Copy link
Member

s-m-e commented Mar 26, 2018

I lazily leave most of the exception trapping on the Unix side to the Python interpreter, but you're right, I should catch them in a more consistent manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants