Bug 1769820

Summary: ftrace -sym= crashes ftrace with java exception
Product: [Fedora] Fedora Reporter: Magnus Glantz <sudo>
Component: fryskAssignee: Cagney <cagney>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: cagney, kasal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: frysk-0.4-68.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-29 00:53:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace of ftrace that fails
none
sosreport from system which has 100% replicator of issue none

Description Magnus Glantz 2019-11-07 14:48:22 UTC
Description of problem:
When trying to trace library calls with ftrace, it crashes with an java exception.

Version-Release number of selected component (if applicable):
Applicable to frysk running on both F30-latest and F31-latest.

On current testbed:
frysk-0.4-65.fc31.x86_64
Linux 5.3.8-300.fc31.x86_64 #1 SMP Tue Oct 29 14:28:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:
100%

Steps to Reproduce:
1. Install Fedora 30 or 31. 
2. dnf -y install frysk
3. ftrace -sym=plt:* ls

Actual results:
$ sudo ftrace -sym='plt:*' ls
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/RecognitionException
	at frysk.bindir.ftrace$1.rule(ftrace.java:151)
	at frysk.bindir.ftrace.parseGenericRules(ftrace.java:140)
	at frysk.bindir.ftrace.parseSymbolRules(ftrace.java:146)
	at frysk.bindir.ftrace.run(ftrace.java:400)
	at frysk.bindir.ftrace.main(ftrace.java:455)
Caused by: java.lang.ClassNotFoundException: antlr.RecognitionException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 5 more

Expected results:
Successful trace

Additional info:
'ftrace -sys= ls' works, but all combinations of -sym option that I can think of fails with the java exception above.

Comment 1 Cagney 2019-11-09 17:32:44 UTC
I can't reproduce this.

Comment 2 Magnus Glantz 2019-11-11 08:18:47 UTC
Created attachment 1634779 [details]
strace of ftrace that fails

Comment 3 Magnus Glantz 2019-11-11 08:25:50 UTC
I can replicate this on another instance of F31... I guess there is a dependency missing then. I only installed the frysk package, nothing else.

Comment 4 Magnus Glantz 2019-11-11 08:27:34 UTC
Created attachment 1634781 [details]
sosreport from system which has 100% replicator of issue

Comment 5 Magnus Glantz 2019-11-11 08:33:40 UTC
From the java error message:

'Caused by: java.lang.ClassNotFoundException: antlr.RecognitionException'

There's something missing. What antlr related package do you have installed cagney?

Comment 6 Magnus Glantz 2019-11-11 08:47:23 UTC
This seems suspect:

[mglantz@darkred ~]$ grep -i "no such file" strace-ftrace.txt |grep -i antlr
[pid 16862] 1573460032.285803 lstat("/usr/share/java/antlr.jar", 0x7f02a8d02120) = -1 ENOENT (No such file or directory)
[pid 16862] 1573460032.285901 stat("/usr/share/java/antlr.jar", 0x7f02a8d041e0) = -1 ENOENT (No such file or directory)
[pid 16862] 1573460032.431554 stat("/usr/share/java/antlr.jar", 0x7f02a8d02180) = -1 ENOENT (No such file or directory)

Comment 7 Magnus Glantz 2019-11-11 08:54:48 UTC
Yes, indeed. /usr/share/java/antlr.jar is provided by the antlr-tool package. After installing this, ftrace works.

Comment 8 Magnus Glantz 2019-11-11 09:09:06 UTC
So, the frysk RPM needs to depend on antlr-tool for Fedora 30+31 at least.

Comment 9 Cagney 2019-11-11 16:40:47 UTC
There's something decidedly screwy going on with dependencies.  It has had:

   BuildRequires:	antlr >= 2.7.4

since 2016.  I guess I now get to spell out all the java runtime dependencies vis:

   Requires: antlr-tool jline ....

as rpm -qR frysk is looking decidedly sparse (but I'm sure that wasn't a requirement).

Comment 10 Fedora Update System 2019-11-20 15:35:57 UTC
FEDORA-2019-6f4defd30f has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-6f4defd30f

Comment 11 Fedora Update System 2019-11-21 02:27:26 UTC
frysk-0.4-68.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-6f4defd30f

Comment 12 Fedora Update System 2019-11-29 00:53:52 UTC
frysk-0.4-68.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.