Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 935018 - sci-geosciences/gpsd is unstable when built with -O3
Summary: sci-geosciences/gpsd is unstable when built with -O3
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal minor (vote)
Assignee: Sci-geo Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2024-06-27 14:22 UTC by János Tóth F.
Modified: 2024-06-29 01:28 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description János Tóth F. 2024-06-27 14:22:39 UTC
I noticed that building sci-geosciences/gpsd with -O3 makes it unstable:
- Chrony keeps loosing the SOCK PPS source (for time synchronization with GPS) within ~24 hours (randomly, this is merely a rough estimate).
I see no other signs of instability but I only use gpsd for time synhronization with Chrony.

Note that the occurrence of this is somewhat random. I experimented with it for about a week and this was my personal conclusion (by the way, LTO doesn't seem to cause any issues).

If anybody can reproduce this then I guess the ebuild for sci-geosciences/gpsd should be modified to force O<=2 (-O2 seems fine on my end and LTO doesn't seem to be an issue either, just -O3).

Reproducible: Sometimes

Steps to Reproduce:
1. Build gpsd with -O2 (or <2) and monitor chronyc sources. Wait a few days to confirm the SOCK PPS source is stable.
2.Build gpsd with -O3 (or >3) and monitor chronyc sources to see if the SOCK PPS source stopped working (last TX is not seconds but several minutes)
Actual Results:  
gpsd's SOCK PPS can't be reached by Chrony

Expected Results:  
SOCK PPS should always be reachable by Chrony as long as the GPS module has a fix on enough satellite signal(s) and "recover" even if the GPS fix was temporarily lost but regained.

Portage 3.0.65 (python 3.12.4-final-0, default/linux/amd64/23.0/no-multilib, gcc-14, glibc-2.39-r9, 6.9.6-gentoo x86_64)
=================================================================
System uname: Linux-6.9.6-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1230_v5_@_3.40GHz-with-glibc2.39
KiB Mem:    65808740 total,    878476 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 27 Jun 2024 00:45:00 +0000
Head commit of repository gentoo: 94c2a67221c06924f719fa843425f09150a238f8
sh bash 5.2_p26-r5
ld GNU ld (Gentoo 2.42 p3) 2.42.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26-r5::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.29.3::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.4.1::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.12.4_p1::gentoo, 3.13.0_beta2_p9::gentoo
dev-lang/rust:             1.79.0::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             14.1.1_p20240622::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.9::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r9::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 3
    sync-rsync-verify-jobs: 1

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O3 -flto -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-march=native -O3 -flto -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=native -O3 -flto -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O3 -flto -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
MAKEOPTS="-j8"
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 --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl amd64 bzip2 cet crypt custom-cflags custom-optimization gdbm iconv ipv6 libtirpc lto ncurses nls openmp pam pcre readline seccomp ssl syslog test-rust unicode xattr zlib" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="ast" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Paul Zander 2024-06-27 14:58:32 UTC
I have hardware to test this, but obviously gonna take a few days to reproduce.
Comment 2 Gary E. Miller 2024-06-29 00:53:40 UTC
Any way to find out what -O3 does differently than -O2?

The SOCKS PPS is in a thread, just for PPS.  It has to do some memory handshakes with Chrony.
Comment 3 Gary E. Miller 2024-06-29 01:14:19 UTC
Do the gpsd regression tests still pass when you build with -O3?

"man gcc" says:

````
-O3 Optimize yet more.  

-O3 turns on all optimizations specified by  -O2 and also turns on the following optimization flags:

      -fgcse-after-reload
      -fipa-cp-clone
      -floop-interchange
      -floop-unroll-and-jam
      -fpeel-loops
      -fpredictive-commoning
      -fsplit-loops
      -fsplit-paths
      -ftree-loop-distribution
      -ftree-partial-pre
      -funswitch-loops
      -fvect-cost-model=dynamic
      -fversion-loops-for-strides

````

So one of those is the problem.
Comment 4 János Tóth F. 2024-06-29 01:17:15 UTC
Sorry for my false report. It's not an -O3 issue. It just took a lot longer this time to glitch out after I rebuilt and restarted gpsd.
I will try to build both gpsd and chrony with -O2 and -fno-lto but I guess the problem might lays elsewhere.

I also tried to use the older SHM interface and that also stopped working after a while.
Comment 5 Gary E. Miller 2024-06-29 01:28:27 UTC
You should consider moving this issue to gpsd's big tracker:

https://gitlab.com/gpsd/gpsd/

Or visit #gpsd on Librechat IRC.