Project

General

Profile

Actions

Bug #1384

open

Assertion `bt_value_get_type(map) == BT_VALUE_TYPE_MAP` fails

Added by Erica Bugden over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Python bindings
Target version:
-
Start date:
08/08/2023
Due date:
% Done:

0%

Estimated time:

Description

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

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)

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 tracing $lttng start
  • Run python script: python3 lttng-live.py (see below)
    • Assertion

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.)

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)
'''

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:

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

instead of this:

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

query_exec = bt2.QueryExecutor(comp_cls, 'sessions',
                               params)

Output

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)
Actions #1

Updated by Erica Bugden over 1 year ago

  • Description updated (diff)
Actions

Also available in: Atom PDF