Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New release: v0.14 #1714

Merged
merged 1 commit into from Jun 20, 2023
Merged

New release: v0.14 #1714

merged 1 commit into from Jun 20, 2023

Conversation

namhyung
Copy link
Owner

It's time for a new release. Please test and report any issues!

In this development cycle, we've seen many interesting changes including:

  • Python language support
  • Runtime option changes with agent
  • Android build support

And of course, a lot more fixes and improvements are there as well. Thanks for all the contributors.

@honggyukim
Copy link
Collaborator

honggyukim commented Jun 3, 2023

Hi, thanks for preparing the release.

I've ran the tests and got the following result.

$ ./runtest.py
      ...
$ cat failed-tests.txt
Compiler                  gcc                                           clang                                       
Test case                 pg             finstrument-fu fpatchable-fun  pg             finstrument-fu fpatchable-fun
------------------------: O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os  O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os
028 replay_backtrace    : NG NG NG NG NG NG NG NG NG NG NG NG NG NG NG  NG NG NG NG NG NG NG NG NG NG NG NG NG NG NG
124 exception           : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK NG NG NG NG NG OK OK OK OK OK
165 graph_sched         : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK OK OK OK OK OK OK OK OK NG OK
182 thread_exit         : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK OK OK OK OK OK SG OK OK OK OK
185 exception2          : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK NG NG NG NG NG OK OK OK OK OK
186 exception3          : OK OK OK OK OK OK OK OK OK OK NG NG NG NG NG  OK OK OK OK OK NG NG NG NG NG NG NG NG NG NG
196 chrome_taskname     : OK OK NG OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
203 arg_dwarf3          : OK OK NG NG NG SK SK SK SK SK OK OK NG NG NG  OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK
204 arg_dwarf4          : OK OK NG NG OK SK SK SK SK SK OK OK NG NG OK  OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK
212 noplt_libcall       : NG NG NG NG NG OK OK OK OK OK OK OK OK OK OK  NG NG NG NG NG NG NG NG NG NG OK OK OK OK OK
251 exception4          : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK NZ NZ NZ NZ NZ OK OK OK OK OK
255 arg_dwarf6          : OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK  NG NG NG NG NG SK SK SK SK SK NG NG NG NG NG
281 agent_trace_toggle  : NG NG NG NG NG NG NG NG NG NG NG NG NG NG NG  NG NG NG NG NG NG NG NG NG NG NG NG NG NG NG

It looks 281 is due to timing issue, but we have to check 028 replay_backtrace test.

$ ./runtest.py -dp -O0 -c gcc 028
Start 1 tests without worker pool

Compiler                  gc
Test case                 pg
------------------------: O0
t028_replay_backtrace: diff result of gcc -pg -O0
--- expect      2023-06-03 14:42:02.775607669 +0900
+++ result      2023-06-03 14:42:02.775607669 +0900
@@ -1 +1,7 @@
+ __monstartup();
+ __cxa_atexit();
+ main() {
+   alloc1() {
+     alloc2() {
+       alloc3() {
  /* [ 0] main */
@@ -4,6 +10,21 @@
  /* [ 3] alloc3 */
- alloc4() {
-   alloc5() {
-     malloc();
-   } /* alloc5 */
- } /* alloc4 */
+         alloc4() {
+           alloc5() {
+             malloc();
+           } /* alloc5 */
+         } /* alloc4 */
+       } /* alloc3 */
+     } /* alloc2 */
+   } /* alloc1 */
+   free1() {
+     free2() {
+       free3() {
+         free4() {
+           free5() {
+             free();
+           } /* free5 */
+         } /* free4 */
+       } /* free3 */
+     } /* free2 */
+   } /* free1 */
+ } /* main */

028 replay_backtrace    : NG

The issue is filed at #1723

@namhyung
Copy link
Owner Author

namhyung commented Jun 3, 2023

Thanks for the report. I've just loaded a fix for the backtrace problem. Also I don't see the problem in the agent tests.

@honggyukim
Copy link
Collaborator

After applying the fix, 028 is fine now. The current failed tests are as follows.

$ cat failed-tests.txt
Compiler                  gcc                                           clang                                       
Test case                 pg             finstrument-fu fpatchable-fun  pg             finstrument-fu fpatchable-fun
------------------------: O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os  O0 O1 O2 O3 Os O0 O1 O2 O3 Os O0 O1 O2 O3 Os
124 exception           : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK NG NG NG NG NG OK OK OK OK OK
150 recv_event          : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK OK OK OK NZ OK OK OK OK OK OK
165 graph_sched         : OK OK OK OK OK OK OK OK OK OK NG OK OK OK OK  OK OK OK OK OK OK OK OK OK OK OK NG OK OK OK
167 recv_sched          : OK OK NZ OK OK OK OK OK OK OK OK OK OK OK NZ  OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
182 thread_exit         : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK OK OK OK OK OK SG OK OK OK OK
185 exception2          : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK NG NG NG NG NG OK OK OK OK OK
186 exception3          : OK OK OK OK OK OK OK OK OK OK NG NG NG NG NG  OK OK OK OK OK NG NG NG NG NG NG NG NG NG NG
203 arg_dwarf3          : OK OK NG NG NG SK SK SK SK SK OK OK NG NG NG  OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK
204 arg_dwarf4          : OK OK NG NG OK SK SK SK SK SK OK OK NG NG OK  OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK
212 noplt_libcall       : NG NG NG NG NG OK OK OK OK OK OK OK OK OK OK  NG NG NG NG NG NG NG NG NG NG OK OK OK OK OK
226 default_opts        : NG OK OK OK OK OK OK NG OK OK OK OK NG OK NG  OK OK OK OK OK OK OK OK OK OK OK OK NG NG OK
251 exception4          : OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK  OK OK OK OK OK NZ NZ NZ NZ NZ OK OK OK OK OK
255 arg_dwarf6          : OK OK OK OK OK SK SK SK SK SK OK OK OK OK OK  NG NG NG NG NG SK SK SK SK SK NG NG NG NG NG
283 agent_time          : NG NG NG NG NG NG NG NG NG NG NG NG NG NG NG  NG NG NG NG NG NG NG NG NG NG NG NG NG NG NG
284 agent_filter        : OK OK OK OK OK OK OK OK OK OK OK OK NZ OK OK  OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK

It shows another agent test failures but it might be related when multiple agents running together so I think it can be ignored.

It also shows a bit more random failures but they don't have to be fixed all together now.

@honggyukim
Copy link
Collaborator

The SG in 182 thread_exit was already reported at #1364.

$ ./runtest.py -O0 -e 182
Start 1 tests without worker pool

Compiler                  gc  cl
Test case                 fp  fp
------------------------: O0  O0
182 thread_exit         : OK  SG

@honggyukim
Copy link
Collaborator

We better run minimal 32-bit build test.

@honggyukim
Copy link
Collaborator

honggyukim commented Jun 3, 2023

And it might be better to ask @bernhardkaindl or @thepaul for basic build check for packaging before making a release.

There could be some issues because we now started to support python tracing from this release.

@honggyukim
Copy link
Collaborator

We better run minimal 32-bit build test.

Build test is fine but unittest with asan complains with some memory leak reports.

@honggyukim
Copy link
Collaborator

I just confirmed that android build is fine without a problem.

$ export NDK=$HOME/tools/android-ndk-r25c
$ export CC=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang
$ export LD=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld

$ ./configure --arch=aarch64 --cross-compile=aarch64-linux-gnu- --without-libpython --without-libstdc++
      ...
$ make
      ...
$ file uftrace
uftrace: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, with debug_info, not stripped

@honggyukim
Copy link
Collaborator

In addition, we might be better to clarify if python2 tracing is supported? I haven't tested it.

@namhyung
Copy link
Owner Author

namhyung commented Jun 9, 2023

I've tested it and it works at least on my machine.

@MichelleJin12
Copy link
Contributor

I have the same problem as #1725 (comment).

(venv) vagrant@vagrant:~/uftrace/tests$ ./runtest.py -P 004
Start 1 tests without worker pool

Python test case          Result
--------------------------------
004 filter_FN           : SG

(venv) vagrant@vagrant:~/uftrace/tests$ ./runtest.py -P
Start 12 tests with 2 worker

Python test case          Result
--------------------------------
001 basic               : OK
002 filter_F            : OK
003 filter_N            : OK
004 filter_FN           : SG
005 srcline             : OK
006 filter_time         : OK
007 filter_depth        : OK
008 file_var            : OK
009 libcall_single      : OK
010 libcall_none        : OK
011 libcall_nested      : OK
012 os_exit             : OK

However, replace # with ''' comment like below, and it passes.

'''Symbol and debug files are finally written at uftrace_trace_python_finish()
when program exits, but os._exit() terminates the program immediately so there
is no chance to write symbol and debug files at the destructor.
The os._exit() is hooked here to prevent this problem.'''

@namhyung
Copy link
Owner Author

I have the same problem as #1725 (comment).

Thanks for testing. But it's not reasonable that deleting the comment changes the result. Are you running the latest version?

@MichelleJin12
Copy link
Contributor

Yes, I run the latest version of uftrace.

You're right, it's not the comment problem. I tested using Python installed on the system, not venv, it passed regardless of the comment.

@namhyung
Copy link
Owner Author

Note for packagers: the default library installation directory was changed to have a separate "uftrace" directory. I think it's better to have it to carry different flavors of libmcount and now python tracing module too. While uftrace should be able to find the installed library, you may want to add it to ld.so.conf or something.

@namhyung
Copy link
Owner Author

@MichelleJin12 thanks for your reply. I've realized that I forgot to push the related changes. Could you please test it again with the current master?

Also I've updated some documents, please correct my English. :)

@MichelleJin12
Copy link
Contributor

Sure,
It passed all Python test cases with the current master, and I checked the updated docs, LGTM.

@namhyung
Copy link
Owner Author

@MichelleJin12 thanks a lot!

This is a new release with some interesting changes!

The first thing is Python language support.  Now uftrace can trace python
functions and methods like C/C++ functions.  Internally, it uses python's
sys.setprofile() and pass the entry/exit info to the libmcount.

For example, it can trace the following python script (it needs to be a
standalone executable - it should have #! line and executable permission).

    $ cat abc.py
    #! /usr/bin/python3
    def a(): b()
    def b(): c()
    def c(): print("Hello")
    if __name__ == '__main__':
        a()

    $ chmod +x abc.py

Then uftrace can trace the functions like below:

    $ uftrace abc.py
    Hello
    # DURATION     TID     FUNCTION
                [235209] | __main__.<module>() {
                [235209] |   a() {
                [235209] |     b() {
                [235209] |       c() {
      10.810 us [235209] |         builtins.print();
      14.926 us [235209] |       } /* c */
      16.628 us [235209] |     } /* b */
      18.867 us [235209] |   } /* a */
      22.000 us [235209] | } /* __main__.<module> */

Not all features work well with python scripts, but filters by name (-F
and -N), depth (-D), time (-t), location (-L) would work.  However you
can use full features for analysis after recording the data.

The next is the improved agent control.  The agent listens to a client
connection in background when started with -g option.  Then users can
connect to it with uftrace live using -p <PID> option.  The <PID> should
be a process ID of the target, not the uftrace itself.

Say we want to trace my program with a filter at first.  Please don't
forget to start an agent.

    $ uftrace record -g -F ^mycode -- myprog

Later we don't want to use the function filter anymore, and decided to use
a time filter instead.  Let's change the option for the uftrace record
like below:

    $ uftrace -p $(pidof myprog) -F ^mycode@clear -t 100us

Note that the above command would not produce any data and just pass the
new options to the existing uftrace record session (for myprog).

One more big thing is Android build support.  While it's not officially
supported, you can build uftrace as an external tool.  This needed various
improvements in terms of portability like abstracting shmem access and
better handling of the tmp directory and dynamic linker behaviors.

It has been tested with Android 9+ on AArch64 and x86_64.  You probably
want to use dynamic tracing due to issues with the Android runtime.
Please see INSTALL.md for the details.

The size filter at replay now works as same as record, since the symbol
file format was changed to save the symbol size as well.

Symbol demangling on Rust programs was improved to handle trait names in a
more compact way.  The new demangling scheme (v0) is not supported yet.

There are also more fixes and improvements.  Thank you contributors!

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
@namhyung namhyung changed the title Preparing a release for v0.14 New release: v0.14 Jun 20, 2023
@namhyung namhyung merged commit 04d73dc into master Jun 20, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants