all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#48941: [powerpc64le-linux] libfaketime CLOCK_MONOTONIC test hangs
@ 2021-06-10  4:21 Chris Marusich
  2021-06-12  2:56 ` Chris Marusich
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Marusich @ 2021-06-10  4:21 UTC (permalink / raw)
  To: 48941

[-- Attachment #1: Type: text/plain, Size: 2820 bytes --]

Hi,

On powerpc64le-linux, using Guix commit
7692295f970a292a3f3db31fc21d05efd97dcb25 on top of Debian unstable, the
libfaketime package fails to build because one of its tests hangs.  It
appears to hang during the CLOCK_MONOTONIC test:

--8<---------------cut here---------------start------------->8---
Running the test program with no faked time specified
$ LD_PRELOAD=../src/libfaketime.so.1 ./timetest
pthread_cond_timedwait: CLOCK_REALTIME test
(Intentionally sleeping 1 second...)
pthread_cond_timedwait: CLOCK_MONOTONIC test
(Intentionally sleeping 1 second..., see docs about CLOCK_MONOTONIC test)
--8<---------------cut here---------------end--------------->8---

There is no output after that last line.  It just sits there.  I left it
there for about 24 hours, and it didn't make any progress.  I tried with
--cores=1, too, but the problem still occurred.  Therefore, it probably
isn't a multithreading issue.

On x86_64-linux Guix, using the aforementioned commit, on top of Fedora
32, the tests pass and the libfaketime builds successfully.  Therefore,
this is probably a platform-specific issue.

The README file for libfaketime says:

>  CLOCK_MONOTONIC test: Running "make test" performs a series of tests
>  after successful compilation of the libfaketime library. On some
>  platforms, the "CLOCK_MONOTONIC test" will apparently hang
>  forever. If and only if this happens on your platform, add the CFLAG
>  -DFORCE_MONOTONIC_FIX to src/Makefile and recompile libfaketime. Do
>  not set FORCE_MONOTONIC_FIX on platforms where the test does not
>  hang.

In fact, we do set this in Guix, via the (apparently undocumented)
FAKETIME_COMPILE_CFLAGS environment variable:

--8<---------------cut here---------------start------------->8---
(define-public libfaketime
  (package
    (name "libfaketime")
    ...
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'configure
                    (lambda* (#:key outputs #:allow-other-keys)
                      (let ((out (assoc-ref outputs "out")))
                        (setenv "CC" "gcc")
                        (setenv "PREFIX" out)

                        ;; XXX: Without this flag, the CLOCK_REALTIME test hangs
                        ;; indefinitely.  See README.packagers for more information.
                        ;; Try removing this for future versions of libfaketime.
                        (setenv "FAKETIME_COMPILE_CFLAGS" "-DFORCE_MONOTONIC_FIX")
    ...
--8<---------------cut here---------------end--------------->8---

In spite of this, the test hangs on powerpc64le-linux.  Out of
curiosity, I tried NOT setting FAKETIME_COMPILE_CFLAGS, but the behavior
was the same: it still got stuck forever on powerpc64le-linux.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: bug#48941: [powerpc64le-linux] libfaketime CLOCK_MONOTONIC test hangs
@ 2021-07-21  5:08 Chris Marusich
  2021-07-21 14:31 ` Kaelyn
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Marusich @ 2021-07-21  5:08 UTC (permalink / raw)
  To: 48941; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 5182 bytes --]

Hi,

I need a little help figuring out how to use gdb in Guix for bug 48941:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48941

Here's the situation.  A libfaketime test hangs forever.  Upstream
suggested I debug it.  I'm trying to, but gdb errors out.  What am I
doing wrong?  It's probably something simple, but I can't see what.

I'll describe what I've done.  First, I started a build like so:

  ./pre-inst-env guix build --keep-failed libfaketime

While the problematic test hung, I found the PID of the test and killed
it.  This caused the build to fail, leaving the build environment for me
to play around in.

I entered a pure environment that contains all the things I need to
debug the test (gcc 10.3.0 is currently the default gcc on
core-updates):

  ./pre-inst-env guix environment --pure libfaketime --ad-hoc gcc-toolchain@10.3.0 gcc-toolchain@10.3.0:debug gdb

In the pure environment, I confirmed I can build and run the hanging
test via the following commands (I added -g in order to get debug
symbols):

  make FAKETIME_COMPILE_CFLAGS='-DFORCE_MONOTONIC_FIX -g' CC=gcc PREFIX=/tmp/guix-build-libfaketime-0.9.9.drv-0/myprefix
  make FAKETIME_COMPILE_CFLAGS='-DFORCE_MONOTONIC_FIX -g' CC=gcc PREFIX=/tmp/guix-build-libfaketime-0.9.9.drv-0/myprefix test

OK, so I can trigger the hang.  Great!  Next step, fire up GDB:

--8<---------------cut here---------------start------------->8---
[0] [env] marusich@suzaku:/tmp/guix-build-libfaketime-0.9.9.drv-0/source/test
$ gdb ./timetest
GNU gdb (GDB) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64le-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./timetest...
(gdb) 
--8<---------------cut here---------------end--------------->8---

The debug symbols provided by gcc-toolchain@10.3.0:debug are under
$GUIX_ENVIRONMENT/lib/debug.  This is the value of GUIX_ENVIRONMENT:

--8<---------------cut here---------------start------------->8---
$ echo $GUIX_ENVIRONMENT
/gnu/store/32fjhp30k34fh0g9f1gmgcj8pc5wldq6-profile
--8<---------------cut here---------------end--------------->8---

By the way, this directory corresponds to glibc 2.33:

--8<---------------cut here---------------start------------->8---
$ realpath /gnu/store/32fjhp30k34fh0g9f1gmgcj8pc5wldq6-profile/lib/debug
/gnu/store/8akrlhc25d7xvi85gzvginw0vdi4zyg4-glibc-2.33-debug/lib/debug
--8<---------------cut here---------------end--------------->8---

Let's tell GDB where to find those debug symbols:

  (gdb) set debug-file-directory /gnu/store/32fjhp30k34fh0g9f1gmgcj8pc5wldq6-profile/lib/debug

Let's also tell GDB to set the environment variables that upstream
recommended when running the test program:

--8<---------------cut here---------------start------------->8---
(gdb) set environment LD_PRELOAD=../src/libfaketime.so.1
(gdb) set environment FAKETIME=-10d
(gdb) set environment NO_FAKE_STAT=1
--8<---------------cut here---------------end--------------->8---

Now run it:

--8<---------------cut here---------------start------------->8---
(gdb) run
Starting program: /tmp/guix-build-libfaketime-0.9.9.drv-0/source/test/timetest 
/bin/sh: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ../src/libfaketime.so.1)
/bin/sh: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /gnu/store/kmblbljiygayhlc5gb02an9imhy90ws9-glibc-2.33/lib/libpthread.so.0)
/bin/sh: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /gnu/store/kmblbljiygayhlc5gb02an9imhy90ws9-glibc-2.33/lib/libdl.so.2)
/bin/sh: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /gnu/store/kmblbljiygayhlc5gb02an9imhy90ws9-glibc-2.33/lib/librt.so.1)
During startup program exited with code 1.
(gdb) 
--8<---------------cut here---------------end--------------->8---

Huh?  What happened?  I've double checked that I'm using gdb provided by
Guix:

--8<---------------cut here---------------start------------->8---
$ type -P gdb
/gnu/store/32fjhp30k34fh0g9f1gmgcj8pc5wldq6-profile/bin/gdb
--8<---------------cut here---------------end--------------->8---

I also tried running gdb by invoking it via that absolute file name, and
it still errored out in the same way.

I'm operating in a --pure environment.  All the tools are provided by
Guix.  I'm surprised that /bin/sh and /lib are even mentioned above.

If anyone can provide any advice, I'd be very grateful.  I'm not sure
how to proceed.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-23  6:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  4:21 bug#48941: [powerpc64le-linux] libfaketime CLOCK_MONOTONIC test hangs Chris Marusich
2021-06-12  2:56 ` Chris Marusich
  -- strict thread matches above, loose matches on Subject: below --
2021-07-21  5:08 Chris Marusich
2021-07-21 14:31 ` Kaelyn
2021-07-22 18:35   ` Thiago Jung Bauermann
2021-07-23  6:01     ` Chris Marusich
2021-07-23  5:34   ` Chris Marusich

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.