kirushyk / gst-instruments

Easy-to-use profiler for GStreamer
GNU Lesser General Public License v3.0
133 stars 41 forks source link

Error: <stdin>: syntax error in line 1 near '(' #51

Open rotemb-hailo opened 3 years ago

rotemb-hailo commented 3 years ago

This is my pipeline:

 PIPELINE="GST_DEBUG_FILE=output.log GST_DEBUG_NO_COLOR=1 \
     LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgstintercept.so GST_DEBUG_DUMP_TRACE_DIR=. \
     gst-launch-1.0 --gst-debug-level=3 \
     filesrc location=detection.mp4 ! decodebin ! videoconvert ! \
     xvimagesink sync=true"

 eval $PIPELINE

I'm using Ubuntu18.04 and GStreamer 1.14

pipeline0.gsttrace.log

This is the gsttrace file (added log suffix because Github doesn't allow it otherwise).

Am I missing something?

zdanek commented 1 year ago

@kirushyk, @rotemb-hailo I can confirm that there's problem with --dot option in the case of this pipeline. I run the same generation on Ubuntu 20.04, Gstreamer 1.16. Other options work correctly, for example:

$ gst-report-1.0 --memory --types pipeline0.gsttrace 
ELEMENT        TYPE               %CPU   %TIME   TIME     INPUT     OUTPUT
avdec_h264-0   avdec_h264           5.4   81.1    164 ms  4.11 MiB   103 MiB
capsfilter0    GstCapsFilter        0.4    6.0   12.1 ms  4.11 MiB  4.11 MiB
xvimagesink0   GstXvImageSink       0.2    3.2   6.54 ms   103 MiB       0 B
h264parse0     GstH264Parse         0.2    3.0   6.04 ms  4.11 MiB  4.11 MiB
qtdemux0       GstQTDemux           0.2    2.8   5.63 ms  4.11 MiB  4.11 MiB
filesrc0       GstFileSrc           0.1    1.8   3.59 ms       0 B  4.11 MiB
multiqueue0    GstMultiQueue        0.1    0.9   1.90 ms  4.11 MiB  4.11 MiB
videoconvert0  GstVideoConvert      0.1    0.9   1.88 ms   103 MiB   103 MiB
typefind       GstTypeFindElement   0.0    0.3    582 us  4.11 MiB  4.11 MiB
decodebin0     GstDecodeBin         0.0    0.0      0 ns       0 B       0 B
pipeline0      ?                    0.0    0.0      0 ns       0 B       0 B

Interestingly, --dot option generates some kind of incomplete svg file, starting with:

digraph cluster_eg0x5585f5092180 {
 rankdir=LR;
 labelloc=t;
 nodesep=.1;
 ranksep=.1;
 fontsize="14";
 style="filled,rounded";
 color=black;
 label="pipeline0";
 node [style="filled", shape=box, fontsize="14", margin="0.1,0.1"];
 edge [labelfontsize="14", fontsize="14"];
 fillcolor="#ffffff";
 label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD COLSPAN="2" ALIGN="RIGHT">?</TD></TR><TR><TD COLSPAN="2" ALIGN="RIGHT">pipeline0</TD></TR><TR><TD ALIGN="RIGHT">Time:</TD><TD ALIGN="RIGHT">0 ns</TD></TR><TR><TD ALIGN="RIGHT"></TD><TD ALIGN="RIGHT">(  0.0%)</TD></TR><TR><TD ALIGN="RIGHT">CPU:</TD><TD ALIGN="RIGHT">  0.0%</TD></TR></TABLE>>;

Attached is the whole file: pipeline.svg.log

please remove .log ext.

kirushyk commented 1 year ago

Looks like .dot file, not .svg. To convert to .svg, try this:

mv pipeline.svg.log pipeline.dot
dot pipeline.dot -Tsvg > pipeline.svg
FrankBau commented 1 year ago

Can confirm the erronous behaviour. Root cause is a generated .dot file starting with digraph cluster_eg(nil) { rankdir=LR; labelloc=t; nodesep=.1; ranksep=.1; where the "(nil)" is clearly not conforming to .dot syntax, see https://graphviz.org/doc/info/lang.html

It happened for me in a longer pipeline using 3rd party AI elements, but also when I call # gst-report-1.0 --dot pipeline0.gsttrace > pipeline0.dot on the OP's .gsttrace from above.

The behaviour is totally unrelated to the svg/dot mixup described above.

kirushyk commented 1 year ago

Can you send me that pipeline0.gsttrace?

FrankBau commented 1 year ago

The trace is large, here is a link:

https://1drv.ms/f/s!AkaYrLPR0ekIrIcz0aQ-9ar1BO3bUw?e=VvgOxQ

The trace was generated on an i.MX8MP embedded system with a yocto-built linux using the head revision cb8977a67 of gst-instruments. It seems that element->identifier is NULL in gst-report.c where %p prints out as (nil). The pipeline is

gst-launch-1.0 -e filesrc location=${PATHNAME} ! decodebin ! tee name=t ! queue ! hailomuxer name=mux \
    t. ! videoconvert ! videoscale ! queue \
    ! hailonet \
    ! queue \
    ! hailofilter \
    ! hailotracker keep-tracked-frames=5 ! queue ! mux. \
    mux. ! queue ! videoconvert ! tee name=tea \
    ! carrillo \
    ! queue ! vpuenc_h264 qp-max=23 ! h264parse ! mp4mux ! filesink location=${FILENAME}_enc.mp4 \
    tea. ! hailoexportfile location=${FILENAME}.json

using hailo AI accelerator and a custom element carrillo.

The same result occurs when I feed the OP's pipeline pipeline0.gsttrace.log to the tools:

$ gst-report-1.0 pipeline0.gsttrace --dot | head
digraph cluster_eg(nil) {
 rankdir=LR;
 labelloc=t;
 nodesep=.1;
...

That one is smaller and probably easier to reproduce.

kirushyk commented 1 year ago

Inspecting this...

jazzatar commented 1 month ago

We have noted the exact same issue

[omni@ng3-2104 ballarddemo]$ gst-report-1.0 --dot gst-top.gsttrace | dot -Tsvg >pipeline_graph.svg
Error: <stdin>: syntax error in line 1 near '('

Noting the presence of nil noted earlier

[omni@ng3-2104 ballarddemo]$ gst-report-1.0 --dot gst-top.gsttrace | head -n 5
digraph cluster_eg(nil) {
 rankdir=LR;
 labelloc=t;
 nodesep=.1;
 ranksep=.1;

Has this been looked further into?

kirushyk commented 1 month ago

@jazzatar send me your file so I can test locally.

jazzatar commented 1 month ago

Attached. gst-top.zip

I also note that it produced two different digraphs once I removed all (nil) instances from the file, this hack job addresses the issues for me

gst-report-1.0 --dot gst-top.gsttrace | sed '1d' | sed -n '/digraph/,$p' | sed -e 's/(nil)//g' | dot -Tsvg >pipeline_graph.svg