driplineorg / dripline-python

python implementation of project8/dripline
Apache License 2.0
3 stars 6 forks source link

SimpleSCPIGetEntity crashes when "base_str" is wrong #150

Open SanshiroEnomoto opened 1 year ago

SanshiroEnomoto commented 1 year ago

For a SCPI device that accepts READ? for readout, if I put READ? in the base_str (which is wrong; should be READ), Dripline crashes instead of printing an error message:

Emss-Cath-Egun_1   | Formatting socket_info: ("10.0.0.58",10001)
Emss-Cath-Egun_1   | Ethernet socket ('10.0.0.58', 10001) established
Emss-Cath-Egun_1   | sending: b'*RST\nRANG:AUTO ON\nSYST:ZCH OFF\nFORM:ELEM READ\n*IDN?\r'
Emss-Cath-Egun_1   | 'KEITHLEY INSTRUMENTS INC.,MODEL 6485,4572064,C01   Jun 23 2010 12:22:00/B01  /J\r'
Emss-Cath-Egun_1   | sync: '*RST\nRANG:AUTO ON\nSYST:ZCH OFF\nFORM:ELEM READ\n*IDN?\r' -> 'KEITHLEY INSTRUMENTS INC.,MODEL 6485,4572064,C01   Jun 23 2010 12:22:00/B01  /J'
Emss-Cath-Egun_1   | service built
Emss-Cath-Egun_1   | creating object from:
Emss-Cath-Egun_1   | {'name': 'nA_Emss_Cath_Egun', 'log_on_set': True, 'base_str': 'READ?', 'module': 'SimpleSCPIGetEntity', 'log_interval': 10, 'get_on_set': True}
Emss-Cath-Egun_1   | ...
Emss-Cath-Egun_1   | queue up start logging for 'nA_Emss_Cath_Egun'
Emss-Cath-Egun_1   | should start logging every 0:00:10
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) ary/scheduler.hh(228): Scheduling a repeating event
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) ary/scheduler.hh(250): New first event
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) ary/scheduler.hh(259): That event was first; waking execution thread
Emss-Cath-Egun_1   | log action id is 0
Emss-Cath-Egun_1   | about to start the service
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [ INFO] (tid 140507385546560) brary/service.cc(141): Connecting to <rabbit-broker:5672>
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) brary/service.cc(269): Opening channel for service <Emss_Cath_Egun>
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) /library/core.cc(287): Opening AMQP connection and creating channel to rabbit-broker:5672
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) /library/core.cc(288): Using broker authentication: dripline:dripline
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(310): Executing first event from the map
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(56): executing
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(232): wrapped execution
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(228): Scheduling a repeating event
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(236): executing the wrapped executable
Emss-Cath-Egun_1   | 2023-09-29 20:44:43 [ERROR] (tid 140507337328384) ity/terminate.cc(53): Caught unhandled exception. what(): Exception: name 'ThrowReply' is not defined
Emss-Cath-Egun_1   | 
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) brary/service.cc(306): Binding keys for synchronous children
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) /library/core.cc(373): Binding key <nA_Emss_Cath_Egun.#> to queue <Emss_Cath_Egun> over exchange <requests>
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) brary/service.cc(314): Binding keys for asynchronous children
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507385546560) /library/core.cc(399): Starting to consume messages on queue <Emss_Cath_Egun>
Emss-Cath-Egun_1   | services started, now to listen
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(292): Starting scheduler
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [ INFO] (tid 140507385546560) brary/service.cc(370): Listening for incoming messages on <Emss_Cath_Egun>
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [ INFO] (tid 140507345721088) y/heartbeater.cc(68): Starting heartbeat loop
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(310): Executing first event from the map
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(56): executing
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(232): wrapped execution
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(228): Scheduling a repeating event
Emss-Cath-Egun_1   | 2023-09-29 20:44:23 [DEBUG] (tid 140507337328384) ary/scheduler.hh(236): executing the wrapped executable
Emss-Cath-Egun_1   | 2023-09-29 20:44:43 [ERROR] (tid 140507337328384) ity/terminate.cc(53): Caught unhandled exception. what(): Exception: name 'ThrowReply' is not defined
Emss-Cath-Egun_1   | 
Emss-Cath-Egun_1   | At:
Emss-Cath-Egun_1   |   /usr/local/lib/python3.5/site-packages/dripline/implementations/ethernet_scpi_service.py(153): send_to_device
Emss-Cath-Egun_1   |   /usr/local/lib/python3.5/site-packages/dripline/implementations/entity_endpoints.py(48): on_get
Emss-Cath-Egun_1   |   /usr/local/lib/python3.5/site-packages/dripline/core/calibrate.py(26): wrapper
Emss-Cath-Egun_1   |   /usr/local/lib/python3.5/site-packages/dripline/core/entity.py(135): scheduled_log
Emss-Cath-Egun_1   | 
Emss-Cath-Egun_1   | 2023-09-29 20:44:43 [ERROR] (tid 140507337328384) ity/terminate.cc(64): Backtrace from terminate() returned 22 frames
Emss-Cath-Egun_1   | 
Emss-Cath-Egun_1   | 2023-09-29 20:44:43 [ERROR] (tid 140507337328384) ity/terminate.cc(73): Backtrace:
Emss-Cath-Egun_1   | [bt]: (0) /usr/local/lib/libScarab_Dripline_DriplinePy.so(_ZN6scarab9terminateEv+0x50) [0x7fca6c04a99d]
Emss-Cath-Egun_1   | [bt]: (1) /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x928c6) [0x7fca6bce28c6]
Emss-Cath-Egun_1   | [bt]: (2) /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x92901) [0x7fca6bce2901]
Emss-Cath-Egun_1   | [bt]: (3) /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x92b34) [0x7fca6bce2b34]
Emss-Cath-Egun_1   | [bt]: (4) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(+0xad101) [0x7fca6baf9101]
Emss-Cath-Egun_1   | [bt]: (5) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(+0x9bc19) [0x7fca6bae7c19]
Emss-Cath-Egun_1   | [bt]: (6) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(+0x134c82) [0x7fca6bb80c82]
Emss-Cath-Egun_1   | [bt]: (7) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(+0x14a308) [0x7fca6bb96308]
Emss-Cath-Egun_1   | [bt]: (8) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(_ZNKSt8functionIFvvEEclEv+0x32) [0x7fca6bae9c86]
Emss-Cath-Egun_1   | [bt]: (9) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(+0xc36a5) [0x7fca6bb0f6a5]
Emss-Cath-Egun_1   | [bt]: (10) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(+0x108a7d) [0x7fca6bb54a7d]
Emss-Cath-Egun_1   | [bt]: (11) /usr/local/lib/python3.5/site-packages/_dripline.cpython-35m-x86_64-linux-gnu.so(_ZNKSt8functionIFvvEEclEv+0x32) [0x7fca6bae9c86]
Emss-Cath-Egun_1   | [bt]: (12) /usr/local/lib/libDripline_DriplinePy.so(_ZN8dripline15simple_executorclESt8functionIFvvEE+0xf1) [0x7fca6b97f029]
Emss-Cath-Egun_1   | [bt]: (13) /usr/local/lib/libDripline_DriplinePy.so(_ZN8dripline9schedulerINS_15simple_executorENSt6chrono3_V212system_clockEE7executeEv+0x33b) [0x7fca6b9800f7]
Emss-Cath-Egun_1   | [bt]: (14) /usr/local/lib/libDripline_DriplinePy.so(_ZSt13__invoke_implIvMN8dripline9schedulerINS0_15simple_executorENSt6chrono3_V212system_clockEEEFvvEPNS0_7serviceEJEET_St21__invoke_memfun_derefOT0_OT1_DpOT2_+0x74) [0x7fca6b981d66]
Emss-Cath-Egun_1   | [bt]: (15) /usr/local/lib/libDripline_DriplinePy.so(_ZSt8__invokeIMN8dripline9schedulerINS0_15simple_executorENSt6chrono3_V212system_clockEEEFvvEJPNS0_7serviceEEENSt15__invoke_resultIT_JDpT0_EE4typeEOSC_DpOSD_+0x37) [0x7fca6b9803e3]
Emss-Cath-Egun_1   | [bt]: (16) /usr/local/lib/libDripline_DriplinePy.so(_ZNSt6thread8_InvokerISt5tupleIJMN8dripline9schedulerINS2_15simple_executorENSt6chrono3_V212system_clockEEEFvvEPNS2_7serviceEEEE9_M_invokeIJLm0ELm1EEEEDTcl8__invokespcl10_S_declvalIXT_EEEEESt12_Index_tupleIJXspT_EEE+0x43) [0x7fca6b985517]
Emss-Cath-Egun_1   | [bt]: (17) /usr/local/lib/libDripline_DriplinePy.so(_ZNSt6thread8_InvokerISt5tupleIJMN8dripline9schedulerINS2_15simple_executorENSt6chrono3_V212system_clockEEEFvvEPNS2_7serviceEEEEclEv+0x18) [0x7fca6b9853b8]
Emss-Cath-Egun_1   | [bt]: (18) /usr/local/lib/libDripline_DriplinePy.so(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJMN8dripline9schedulerINS3_15simple_executorENSt6chrono3_V212system_clockEEEFvvEPNS3_7serviceEEEEEE6_M_runEv+0x1c) [0x7fca6b9852ee]
Emss-Cath-Egun_1   | [bt]: (19) /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbbb2f) [0x7fca6bd0bb2f]
Emss-Cath-Egun_1   | [bt]: (20) /lib/x86_64-linux-gnu/libpthread.so.0(+0x7fa3) [0x7fca6d036fa3]
Emss-Cath-Egun_1   | [bt]: (21) /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7fca6cdda4cf]
nsoblath commented 6 months ago

@SanshiroEnomoto do you have a suggested solution?

wcpettus commented 6 months ago

This could also get caught up in better error handling that Christine mentioned on today's call - so it may be part of a broader problem/solution

SanshiroEnomoto commented 6 months ago

As Walter said, I think this is an issue related to error reporting. Crashing is fine, as keeping going would not produce useful data anyway (stopping would be better, though), but it was very difficult for me (who is not familiar with the code set) to figure out this simple cause. The worst thing is the message of Caught unhandled exception. what(): Exception: name 'ThrowReply' is not defined, which I consider is a bug and needs to be fixed.

nsoblath commented 6 months ago

I believe the unhandled exception in this issue will be fixed by one of the deficiencies listed in https://github.com/driplineorg/dripline-cpp/issues/103.

I've also made a dedicated issue for exception handling in dl-py itself: #166. I have not yet looked through the code in Implementations to consider its exceptions use.