Project

General

Profile

Bug #1384

Updated by Erica Bugden 9 months ago

Hello! I triggered an internal assertion while trying to, presumably incorrectly, query the lttng-live component class. 

 h1. Software 

 * lttng tools: @lttng (LTTng Trace Control) 2.14.0-pre - O-Beer - v2.12.0-rc1-1528-g5983bb6d3@ 
 * babeltrace2: @Babeltrace 2.1.0-rc1 "Codename TBD" [v1.2.0-3704-gdbea6be2]@ (configured with plugins, python bindings support) 

 h1. Procedure 

 * Start root session daemon: @$sudo lttng-sessiond --daemonize@ 
 * Create live session: @$lttng create my-session --live@ 
 * Enable events: @$lttng enable-event --kernel sched-switch,sched_process_fork@ 
 * Start (Start tracing? I can't remember if I remembered to start tracing before running the script, but I believe I did @$lttng start@ start@) 
 * Run python script: @python3 lttng-live.py@ lttng-live-py@ (see below) 
 ** Assertion 

 h1. Python script 

 Note: The script is noisy as some code/comments are irrelevant/incorrect/inconsistent. (It's originally based on the query example in the Python bindings documentation.) 

 <pre> 
 import bt2 
 import sys 

 # Get the `source.ctf.fs` component class from the `ctf` plugin. 
 # `source.ctf.lttng-live` component class instead 
 # (list plugins/components with $babeltrace2 list-plugins) 
 comp_cls = bt2.find_plugin('ctf').source_component_classes['lttng-live'] 

 # The `babeltrace.support-info` query operation expects a `type` 
 # parameter (set to `directory` here) and an `input` parameter (the 
 # actual path or string to check, in this case the first command-line 
 # argument). 
 # 
 # See `babeltrace2-query-babeltrace.support-info(7)`. 
 params = { 
     'url': 'net://localhost/host/luna/my-session' 
 } 
 ''' 
 params = { 
     'type': 'string', 
     'input': sys.argv[1], 
 } 
 ''' 

 # Create a query executor. 
 # 
 # This is the environment in which query operations happens. The 
 # queried component class has access to this executor, for example to 
 # retrieve the query operation's logging level. 
 query_exec = bt2.QueryExecutor(comp_cls, 'sessions', 
                                'inputs=net://localhost/host/luna/my-session') 
 ''' 
 query_exec = bt2.QueryExecutor(comp_cls, 'babeltrace.support-info', 
                                params) 
 ''' 
                               
 # Query the component class through the query executor. 
 # 
 # This method returns the result. 
 result = query_exec.query() 

 # Print the result. 
 print(result) 

 # Try to iterate on the trace. 
 ''' 
 for msg in bt2.TraceCollectionMessageIterator('net://localhost/host/luna/my-session'): 
     if type(msg) is bt2._EventMessageConst: 
         print(msg.event.name) 
 ''' 
 </pre> 

 If I remember correctly, *the script line change that triggered the assertion was expressing the query parameters directly as a string* (rather than a dictionary). As in this: 

 <pre> 
 query_exec = bt2.QueryExecutor(comp_cls, 'sessions', 
                                'inputs=net://localhost/host/luna/my-session') 
 </pre> 

 instead of this: 

 <pre> 
 params = { 
     'url': 'net://localhost/host/luna/my-session' 
 } 

 query_exec = bt2.QueryExecutor(comp_cls, 'sessions', 
                                params) 
 </pre> 

 h1. Output 

 <pre> 
 erica@luna:~$ python3 lttng-live.py 

  (╯°□°)╯︵ ┻━┻    param-validation.c:196: validate_map_value(): Assertion `bt_value_get_type(map) == BT_VALUE_TYPE_MAP` failed. 
 Aborted (core dumped) 
 </pre>

Back