Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 596382

Summary: =media-libs/gstreamer-1.8.3 fails tests gst/gstsystemclock and pipelines/parse-launch (system clock-related?)
Product: Gentoo Linux Reporter: Émeric Maschino <emeric.maschino>
Component: Current packagesAssignee: GStreamer package maintainers <gstreamer>
Status: RESOLVED FIXED    
Severity: normal CC: emeric.maschino, gstreamer, ia64, matoro_bugzilla_gentoo, mattst88, moiman, slyfox, whissi
Priority: Normal Keywords: TESTFAILURE, UPSTREAM
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://lkml.org/lkml/2022/8/15/77
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
environment
tests/check/test-suite.log
bug-596382.patch
bug-596382.patch

Description Émeric Maschino 2016-10-07 00:40:34 UTC
Created attachment 449374 [details]
build.log

Hi,

While stabilizing gnome-3.20, gstreamer-1.8.3 fails to emerge with FEATURES=test.

From build.log and tests/check/test-suite.log, this seems to be related to system clock:

FAIL: gst/gstsystemclock
========================

Running suite(s): GstSystemClock
93%: Checks: 15, Failures: 1, Errors: 0
/var/tmp/portage/media-libs/gstreamer-1.8.3/work/gstreamer-1.8.3/tests/check/gst/gstsystemclock.c:745:F:waiting:test_resolution:0: Assertion 'diff == 0 || diff >= resolution' failed
FAIL gst/gstsystemclock (exit status: 1)

FAIL: pipelines/parse-launch
============================

Running suite(s): Parse Launch syntax
87%: Checks: 8, Failures: 1, Errors: 0
/var/tmp/portage/media-libs/gstreamer-1.8.3/work/gstreamer-1.8.3/tests/check/pipelines/parse-launch.c:446:F:parselaunch:delayed_link:0: Failure 'gst_element_get_state (src, NULL, NULL, GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_FAILURE' occurred
FAIL pipelines/parse-launch (exit status: 1)

Please let me know how I can help diagnose further.

Thanks,

     Émeric
Comment 1 Émeric Maschino 2016-10-07 00:41:23 UTC
Created attachment 449376 [details]
environment
Comment 2 Émeric Maschino 2016-10-07 00:42:07 UTC
Created attachment 449378 [details]
tests/check/test-suite.log
Comment 3 Émeric Maschino 2016-10-07 00:42:45 UTC
emerge --info output:

Portage 2.2.26 (python 3.4.3-final-0, default/linux/ia64/13.0/desktop/gnome/systemd, gcc-4.9.3, glibc-2.22-r4, 4.1.15-gentoo-r1 ia64)
=================================================================
System uname: Linux-4.1.15-gentoo-r1-ia64-Madison-with-gentoo-2.2
KiB Mem:    24984848 total,  11800720 free
KiB Swap:     524272 total,    509456 free
Timestamp of repository gentoo: Wed, 28 Sep 2016 15:30:01 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r1::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.4.3-r1::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.21.7::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.5.4::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

my_ebuilds
    location: /var/lib/layman/my_ebuilds
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="ia64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="ia64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mtune=itanium2"
CHOST="ia64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -mtune=itanium2"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe -mtune=itanium2"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -mtune=itanium2"
GENTOO_MIRRORS="ftp://mirrors.linuxant.fr/distfiles.gentoo.org/"
LANG="fr_FR.utf8"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa berkdb branding bzip2 cairo cdda cdr cli colord cracklib crypt cups cxx dbus dri dts dvdr eds encode evo exif fam firefox flac fortran gdbm gif glamor gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk ia64 iconv introspection ipv6 jpeg lcms ldap libnotify libsecret mad mng modules mp3 mp4 mpeg nautilus ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt3support qt4 readline sdl session spell ssl startup-notification svg systemd tcpd tiff tracker truetype udev udisks unicode upower usb vorbis wxwidgets xattr xcb xml xv xvid zlib" ALSA_CARDS="fm801" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" L10N="fr" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="fr" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="radeon fbdev modesetting" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 4 Émeric Maschino 2016-10-07 00:44:47 UTC
emerge -pqv output:

[ebuild   R   ] media-libs/gstreamer-1.8.3  USE="caps introspection nls {test*} (-orc)"
Comment 5 Émeric Maschino 2016-10-07 01:16:46 UTC
(In reply to Émeric Maschino from comment #0)

I forgot to say that this is on ia64 platform.

     Émeric
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2018-02-22 07:37:52 UTC
Had a look at it today. It fails due to too low clock resolution.

  $ cat gst-clock.c 
  // gcc gst-clock.c -o a `pkg-config --cflags --libs gstreamer-1.0` && ./a
  #include <stdio.h>
  #include <gst/gstclock.h>
  #include <gst/gstsystemclock.h>
  
  int main() {
    GstClock * clock = gst_system_clock_obtain ();
    GstClockTime resolution = gst_clock_get_resolution (clock);
    fprintf (stderr, "res=%llu\n", (long long)resolution);
  }

amd64:
  $ gcc gst-clock.c -o a `pkg-config --cflags --libs gstreamer-1.0` && ./a
  res=1

ia64:
  $ gcc gst-clock.c -o a `pkg-config --cflags --libs gstreamer-1.0` && ./a
  res=4000000
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2018-02-22 23:49:48 UTC
It think the issue here is mismatch in resolution and values reported.
It looks like ia64 uses ar.itc (equivalent of x86 rdtsc) or order of clock cycle precision. I'll try to figure a bit more before pointing at faulty component.

$ cat clock.c 
// gcc clock.c -o a -lrt && ./a
#include <stdio.h>
#include <time.h>
#include <unistd.h>

int main() {
    struct timespec res;
    struct timespec before;
    struct timespec sleep_for = { .tv_sec = 0, .tv_nsec = 500 * 1000, };
    struct timespec after;
    clockid_t clk_id = CLOCK_MONOTONIC;

    clock_getres(clk_id, &res);
    clock_gettime(clk_id, &before);

    //nanosleep(&sleep_for, NULL);

    clock_gettime(clk_id, &after);

    fprintf (stderr, "res:   %lli ns\n",   res.tv_sec * 1000000000LL
                                         + res.tv_nsec);
    fprintf (stderr, "delta: %lli ns\n",   (after.tv_sec  - before.tv_sec) * 1000000000LL
                                         + (after.tv_nsec - before.tv_nsec));
    return 0;
}

$ gcc clock.c -o a -lrt -O2 && ./a
res:   4000000 ns
delta: 118 ns
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2018-02-25 11:00:15 UTC
(In reply to Sergei Trofimovich from comment #7)
> $ gcc clock.c -o a -lrt -O2 && ./a
> res:   4000000 ns
> delta: 118 ns

ia64 has no kernel support for HIGHRES TIMERS. Thus timer tick resolution is 1/HZ=250. But timer measurement is as fast as ar.itc "timer" provides:
    # cat /proc/cpuinfo  | grep itc
    itc MHz    : 399.220344
which is 2.5 ns :)

Both clock_getres and clock_gettime are called from kernel. I'm still not sure if clock_getres() should report higher timer resolution but it feels like it should.
Comment 9 Thomas Deutschmann (RETIRED) gentoo-dev 2018-03-17 21:41:56 UTC
I hit the same test failure for GstSystemClock test only on x86 as well when building media-libs/gstreamer-1.12.4.

However, only on a busy system doing more than just building gstreamer. It is passing when the system load is low, i.e. only gstreamer build/test is running.

See https://lists.freedesktop.org/archives/gstreamer-bugs/2007-May/031857.html -- I suggest to disable this test.
Comment 10 Matt Turner gentoo-dev 2018-05-25 04:02:38 UTC
I just hit this too. Looks like there's a fix upstream.
Comment 11 Thomas Deutschmann (RETIRED) gentoo-dev 2018-07-20 15:07:32 UTC
Still randomly happening with gstreamer-1.14.1.
Comment 12 Mart Raudsepp gentoo-dev 2018-07-30 05:49:57 UTC
I put my system under heavy load and ran the src_test phase and still can't reproduce :(

Should just gst/gstsystemclock be skipped for occasional x86 failures or pipelines/parse-launch as well?
Comment 13 Thomas Deutschmann (RETIRED) gentoo-dev 2018-07-30 23:14:36 UTC
I just hit this again. Please skip both.
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2019-06-17 07:13:42 UTC
(In reply to Sergei Trofimovich from comment #8)
> (In reply to Sergei Trofimovich from comment #7)
> > $ gcc clock.c -o a -lrt -O2 && ./a
> > res:   4000000 ns
> > delta: 118 ns
> 
> ia64 has no kernel support for HIGHRES TIMERS. Thus timer tick resolution is
> 1/HZ=250. But timer measurement is as fast as ar.itc "timer" provides:
>     # cat /proc/cpuinfo  | grep itc
>     itc MHz    : 399.220344
> which is 2.5 ns :)
> 
> Both clock_getres and clock_gettime are called from kernel. I'm still not
> sure if clock_getres() should report higher timer resolution but it feels
> like it should.

Dropped the ball on this. Will look at the ia64-specifict in some indefinite future. For now let's assume ia64's clock (guaranteed) resolution is always low and thus always fails this test.
Comment 15 matoro archtester 2022-05-02 01:06:55 UTC
This IS still reproducible on =media-libs/gstreamer-1.20.1.
Comment 16 matoro archtester 2022-05-27 15:08:04 UTC
Created attachment 781082 [details, diff]
bug-596382.patch

Okay, I actually came up with a kernel patch that fixes this based on slyfox's amazing notes.  This is my first time writing kernel code so this could be WILDLY wrong.  But I'll see if I can get anyone to give me a clue if it's correct or not.
Comment 17 matoro archtester 2022-05-27 15:25:39 UTC
Created attachment 781088 [details, diff]
bug-596382.patch
Comment 18 matoro archtester 2022-12-20 05:18:26 UTC
This is fixed with kernel 6.1!  media-libs/gstreamer-1.20.4 passes all tests on the new kernel.