Bug 205370 - graphics/rawtherapee: Always dumps core (on SIGABRT) on exit
Summary: graphics/rawtherapee: Always dumps core (on SIGABRT) on exit
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Matthias Andree
URL:
Keywords: crash
Depends on:
Blocks:
 
Reported: 2015-12-17 00:26 UTC by Andrew
Modified: 2019-03-23 23:13 UTC (History)
1 user (show)

See Also:


Attachments
xz compressed patch against ports/graphics/rawtherapee (4.24 KB, application/x-xz-compressed)
2019-03-23 18:17 UTC, Matthias Andree
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew 2015-12-17 00:26:14 UTC
Always dumps core on exit.


FreeBSD bclinton 10.2-STABLE FreeBSD 10.2-STABLE #0 r291083: Sun Nov 22 21:34:30 PST 2015     toor@bclinton:/usr/obj/usr/src/sys/GENERIC  amd64


root@bclinton:rawtherapee# svn log -l 1
------------------------------------------------------------------------
r395090 | mandree | 2015-08-23 06:52:27 -0700 (Sun, 23 Aug 2015) | 13 lines
Comment 1 Matthias Andree freebsd_committer freebsd_triage 2015-12-18 07:42:17 UTC
Works for me. Please make sure you have a fully updated system with matching libraries.

If it keeps crashing after reinstalling all packages, please recompile from source with WITH_DEBUG=yes on the make command line, and provide (attach) a stack backtrace before reopening this bug.
https://www.freebsd.org/doc/en/books/developers-handbook/debugging.html
Comment 2 Andrew 2015-12-19 06:24:25 UTC
How do I make sure I have matching libraries?

I built all ports (from up-to-date tree) in poudriere. Then I reinstall all packages by running pkg upgrade -f. Here is what I get when rawtherapee exits:

console output:

(rawtherapee:946): GLib-GObject-WARNING **: The property GtkWindow:allow-shrink is deprecated and shouldn't be used anymore. It will be removed in a future version.

(rawtherapee:946): GVFS-RemoteVolumeMonitor-WARNING **: remote volume monitor with dbus name org.gtk.Private.HalVolumeMonitor is not supported

(rawtherapee:946): GVFS-RemoteVolumeMonitor-WARNING **: remote volume monitor with dbus name org.gtk.Private.GPhoto2VolumeMonitor is not supported
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_lock': Invalid argument.  Aborting.
Abort trap (core dumped)



gdb backtrace:

Program received signal SIGABRT, Aborted.
[Switching to Thread 80fc06400 (LWP 101005/rawtherapee)]
0x0000000807cb7b4a in thr_kill () from /lib/libc.so.7
(gdb) bt
#0  0x0000000807cb7b4a in thr_kill () from /lib/libc.so.7
#1  0x0000000807cb7b36 in raise () from /lib/libc.so.7
#2  0x0000000807cb7ab9 in abort () from /lib/libc.so.7
#3  0x0000000801e2b455 in g_mutex_lock () from /usr/local/lib/libglib-2.0.so.0
#4  0x0000000801e2b41e in g_mutex_lock () from /usr/local/lib/libglib-2.0.so.0
#5  0x0000000802504f82 in Glib::ObjectBase::~ObjectBase () from /usr/local/lib/libglibmm-2.4.so.1
#6  0x000000080534332d in Gdk::Pixbuf::~Pixbuf () from /usr/local/lib/libgdkmm-2.4.so.1
#7  0x0000000805343399 in virtual thunk to Gdk::Pixbuf::~Pixbuf() () from /usr/local/lib/libgdkmm-2.4.so.1
#8  0x0000000801dc8613 in g_datalist_clear () from /usr/local/lib/libglib-2.0.so.0
#9  0x0000000801b64c4a in g_object_unref () from /usr/local/lib/libgobject-2.0.so.0
#10 0x0000000807d16610 in __cxa_finalize () from /lib/libc.so.7
#11 0x0000000807cb7a4c in exit () from /lib/libc.so.7
#12 0x0000000000458cd6 in ?? ()
#13 0x0000000000458b60 in ?? ()
#14 0x0000000000000000 in ?? ()
Comment 3 Matthias Andree freebsd_committer freebsd_triage 2015-12-19 12:50:01 UTC
Hmmm... what do you get when you run 

ldd /usr/local/bin/rawtherapee
?

I don't see such crashes here.

Are you using remote GNOME-based mounts (gfvs file systems)?

Does it suffice to just start RawTherapee and close it?

Do the crashes persist if you move away (rename) RawTherapee's configuration files, and delete its caches?
Comment 4 Andrew 2015-12-19 19:28:17 UTC
$ ldd /usr/local/bin/rawtherapee
/usr/local/bin/rawtherapee:
	libthr.so.3 => /lib/libthr.so.3 (0x801014000)
	libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x801239000)
	libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x801492000)
	libz.so.6 => /lib/libz.so.6 (0x8016c7000)
	libtiff.so.5 => /usr/local/lib/libtiff.so.5 (0x8018dd000)
	libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x801b4f000)
	libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x801d97000)
	libintl.so.8 => /usr/local/lib/libintl.so.8 (0x80209e000)
	libgthread-2.0.so.0 => /usr/local/lib/libgthread-2.0.so.0 (0x8022a9000)
	libglibmm-2.4.so.1 => /usr/local/lib/libglibmm-2.4.so.1 (0x8024aa000)
	libsigc-2.0.so.0 => /usr/local/lib/libsigc-2.0.so.0 (0x80272c000)
	libgtk-x11-2.0.so.0 => /usr/local/lib/libgtk-x11-2.0.so.0 (0x802a00000)
	libgdk-x11-2.0.so.0 => /usr/local/lib/libgdk-x11-2.0.so.0 (0x803035000)
	libpangocairo-1.0.so.0 => /usr/local/lib/libpangocairo-1.0.so.0 (0x8032e6000)
	libatk-1.0.so.0 => /usr/local/lib/libatk-1.0.so.0 (0x8034f3000)
	libcairo.so.2 => /usr/local/lib/libcairo.so.2 (0x80371c000)
	libgdk_pixbuf-2.0.so.0 => /usr/local/lib/libgdk_pixbuf-2.0.so.0 (0x803a32000)
	libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x803c52000)
	libpangoft2-1.0.so.0 => /usr/local/lib/libpangoft2-1.0.so.0 (0x803fbf000)
	libpango-1.0.so.0 => /usr/local/lib/libpango-1.0.so.0 (0x8041d3000)
	libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x804424000)
	libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x804664000)
	libgtkmm-2.4.so.1 => /usr/local/lib/libgtkmm-2.4.so.1 (0x804a00000)
	libatkmm-1.6.so.1 => /usr/local/lib/libatkmm-1.6.so.1 (0x8050ba000)
	libgdkmm-2.4.so.1 => /usr/local/lib/libgdkmm-2.4.so.1 (0x80530c000)
	libgiomm-2.4.so.1 => /usr/local/lib/libgiomm-2.4.so.1 (0x805562000)
	libpangomm-1.4.so.1 => /usr/local/lib/libpangomm-1.4.so.1 (0x805932000)
	libcairomm-1.0.so.1 => /usr/local/lib/libcairomm-1.0.so.1 (0x805b61000)
	liblcms2.so.2 => /usr/local/lib/liblcms2.so.2 (0x805d88000)
	libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x805fe1000)
	libfftw3f.so.3 => /usr/local/lib/libfftw3f.so.3 (0x806207000)
	libiptcdata.so.0 => /usr/local/lib/libiptcdata.so.0 (0x806567000)
	libcanberra-gtk.so.0 => /usr/local/lib/libcanberra-gtk.so.0 (0x806772000)
	libX11.so.6 => /usr/local/lib/libX11.so.6 (0x806976000)
	libcanberra.so.0 => /usr/local/lib/libcanberra.so.0 (0x806caf000)
	libbz2.so.4 => /usr/lib/libbz2.so.4 (0x806ebe000)
	libm.so.5 => /lib/libm.so.5 (0x8070d0000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x8072f9000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x8075b8000)
	libgomp.so.1 => /usr/local/lib/gcc48/libgomp.so.1 (0x8077d5000)
	libgcc_s.so.1 => /usr/local/lib/gcc48/libgcc_s.so.1 (0x8079e3000)
	libc.so.7 => /lib/libc.so.7 (0x807bf9000)
	liblzma.so.5 => /usr/lib/liblzma.so.5 (0x807fa5000)
	libjbig.so.2 => /usr/local/lib/libjbig.so.2 (0x8081ca000)
	libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x8083d7000)
	libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x8086d1000)
	libffi.so.6 => /usr/local/lib/libffi.so.6 (0x808946000)
	libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x808b4d000)
	libXrender.so.1 => /usr/local/lib/libXrender.so.1 (0x808d50000)
	libXinerama.so.1 => /usr/local/lib/libXinerama.so.1 (0x808f59000)
	libXi.so.6 => /usr/local/lib/libXi.so.6 (0x80915b000)
	libXrandr.so.2 => /usr/local/lib/libXrandr.so.2 (0x809369000)
	libXcursor.so.1 => /usr/local/lib/libXcursor.so.1 (0x809572000)
	libXext.so.6 => /usr/local/lib/libXext.so.6 (0x80977c000)
	libXcomposite.so.1 => /usr/local/lib/libXcomposite.so.1 (0x80998d000)
	libXdamage.so.1 => /usr/local/lib/libXdamage.so.1 (0x809b8f000)
	libXfixes.so.3 => /usr/local/lib/libXfixes.so.3 (0x809d91000)
	libharfbuzz.so.0 => /usr/local/lib/libharfbuzz.so.0 (0x809f96000)
	libpixman-1.so.0 => /usr/local/lib/libpixman-1.so.0 (0x80a1f0000)
	libEGL.so.1 => /usr/local/lib/libEGL.so.1 (0x80a497000)
	libxcb-shm.so.0 => /usr/local/lib/libxcb-shm.so.0 (0x80a792000)
	libxcb-render.so.0 => /usr/local/lib/libxcb-render.so.0 (0x80a994000)
	libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x80ab9d000)
	libGL.so.1 => /usr/local/lib/libGL.so.1 (0x80adbc000)
	libvorbisfile.so.3 => /usr/local/lib/libvorbisfile.so.3 (0x80b0f2000)
	libltdl.so.7 => /usr/local/lib/libltdl.so.7 (0x80b2fa000)
	librpcsvc.so.5 => /usr/lib/librpcsvc.so.5 (0x80b503000)
	libgraphite2.so.3 => /usr/local/lib/libgraphite2.so.3 (0x80b70c000)
	librt.so.1 => /usr/lib/librt.so.1 (0x80b93e000)
	libnvidia-glsi.so.1 => /usr/local/lib/libnvidia-glsi.so.1 (0x80bb44000)
	libXau.so.6 => /usr/local/lib/libXau.so.6 (0x80bdc9000)
	libpthread-stubs.so.0 => /usr/local/lib/libpthread-stubs.so.0 (0x80bfcb000)
	libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x80c1cc000)
	libnvidia-tls.so.1 => /usr/local/lib/libnvidia-tls.so.1 (0x80c3d1000)
	libnvidia-glcore.so.1 => /usr/local/lib/libnvidia-glcore.so.1 (0x80c600000)
	libvorbis.so.0 => /usr/local/lib/libvorbis.so.0 (0x80f13a000)
	libogg.so.0 => /usr/local/lib/libogg.so.0 (0x80f367000)




$ ps axl|grep gvfs
1001   814     1   0  20  0   52592   6004 select   I     -     0:00.04 /usr/local/libexec/gvfsd
1001   816     1   0  43  0   65540   6480 select   I     -     0:00.01 /usr/local/libexec/gvfsd-fuse /home/andrew/.gvfs -f -o big_writes
1001   829     1   0  20  0   54956   6276 select   I     -     0:00.01 /usr/local/libexec/gvfs-hal-volume-monitor
1001   853     1   0  20  0   66188   6712 select   I     -     0:00.01 /usr/local/libexec/gvfs-gphoto2-volume-monitor
1001   883     1   0  20  0   70328   8444 kqread   I     -     0:42.91 /usr/local/libexec/gvfsd-trash --spawner :1.1 /org/gtk/gvfs/exec_spaw/0
1001   918     1   0  20  0   46316   6428 select   I     -     0:00.03 /usr/local/libexec/gvfsd-metadata



Yes, I start and immediately stop Rawtherapee and it dumps core.


Deleting RT config and cache didn't help:

$ rm -rf ./.cache/RawTherapee4.1 ./.config/RawTherapee4.1 ./.config/RawTherapee
$ rawtherapee 

(rawtherapee:28091): GLib-GObject-WARNING **: The property GtkWindow:allow-shrink is deprecated and shouldn't be used anymore. It will be removed in a future version.

(rawtherapee:28091): GVFS-RemoteVolumeMonitor-WARNING **: remote volume monitor with dbus name org.gtk.Private.HalVolumeMonitor is not supported

(rawtherapee:28091): GVFS-RemoteVolumeMonitor-WARNING **: remote volume monitor with dbus name org.gtk.Private.GPhoto2VolumeMonitor is not supported
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_lock': Invalid argument.  Aborting.
Abort trap (core dumped)
Comment 5 Andrew 2015-12-21 00:10:21 UTC
BTW in FreeBSD RT is oldish version 4.2 while the upstream is 4.2.536. Some interesting new functionality was introduced after 4.2 like wavelets. Should I create another PR to ask to update the port?
Comment 6 Matthias Andree freebsd_committer freebsd_triage 2015-12-21 00:54:31 UTC
I think those 4.X.Y versions are rather experimental, but if it fixes the crash by coincidence, and does not cause too many new regressions, we might go for it.
Comment 7 Matthias Andree freebsd_committer freebsd_triage 2016-05-23 22:22:35 UTC
Any insights, updates, new ideas...?  I'm stuck here.
Comment 8 Matthias Andree freebsd_committer freebsd_triage 2016-05-26 16:37:14 UTC
Original reporter answered off-list that he's no longer using this version of rawtherapee on FreeBSD and can't answer my questions. Closing the bug; if someone else can reproduce the original problem, please reopen this PR.
Comment 9 Matthias Andree freebsd_committer freebsd_triage 2017-01-29 18:43:18 UTC
Reopening. With rawtherapee-5.0-gtk3, I can reproduce the bug with similar backtrace through the destructors, and containing such chunks:

#4  0x0000000801e2b41e in g_mutex_lock () from /usr/local/lib/libglib-2.0.so.0
#5  0x0000000802504f82 in Glib::ObjectBase::~ObjectBase () from /usr/local

There's some code in MyMutex (threadutils.h) that we might be able to leverage to see what this is up to.
Comment 10 freebsd 2017-10-25 19:49:51 UTC
I see the same behavior.  Seems to work fine but always crashes on exit.

FreeBSD breakaway.dreamchaser.org 10.3-RELEASE-p20 FreeBSD 10.3-RELEASE-p20 #0: Wed Jul 12 03:13:07 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

I may have a conflict somewhere in my ports tree, will rebuild when I get back Nov 1.
Comment 11 Matthias Andree freebsd_committer freebsd_triage 2017-10-25 20:43:09 UTC
Anyone, don't waste your time on any more than ulimit -c 0 unless you have the means to debug through the libraries, possibly through Glib and Gtk and whatnot, and get your hands dirty with destructor ordering, checking for double deallocation, and similar, and have a decent understanding of C++.

Trial and error on package reinstallation isn't getting you anywhere.  We see this crash on exit on cleanly installed systems, and I've tried to debug each and every new minor release of rawtherapee since, including 5.3, each time to no avail, and the MyMutex debugging stuff didn't point out anything wrong either.
Comment 12 Matthias Andree freebsd_committer freebsd_triage 2018-03-21 16:02:31 UTC
Bug persists in 5.4.
Comment 13 Matthias Andree freebsd_committer freebsd_triage 2018-12-22 10:28:44 UTC
Bug persists in 5.5.
Comment 14 Matthias Andree freebsd_committer freebsd_triage 2019-01-07 00:18:49 UTC
(In reply to Matthias Andree from comment #13)
The port has been changed so it installs a wrapper script that uses ulimit -c 0 to prevent core dumps from being written, which takes up a lot of time and disk space even on reasonably fast machines. This masks the bug, but does not resolve it. The bug might be in one of the libraries that Rawtherapee requires, see the upstream bug report for details, https://github.com/Beep6581/RawTherapee/issues/3636
Comment 15 Matthias Andree freebsd_committer freebsd_triage 2019-03-23 16:47:25 UTC
The upstream has made progress and the issue is solved in their "dev" branch on Git, the actual fix came from the "hidpi-icons" branch that got merged.
<https://github.com/Beep6581/RawTherapee/pull/5215>
<https://github.com/Beep6581/RawTherapee/issues/3636#issuecomment-471176169>

I have backported that patch onto 5.5 and am currently testing this.
Comment 16 Matthias Andree freebsd_committer freebsd_triage 2019-03-23 18:17:51 UTC
Created attachment 203072 [details]
xz compressed patch against ports/graphics/rawtherapee

if someone wants to help testing on odd systems (I have 12.0 amd64 here), uncompress this attachment, patch *a copy* of your /usr/ports/graphics/rawtherapee with it and give it a spin.
Comment 17 commit-hook freebsd_committer freebsd_triage 2019-03-23 23:09:18 UTC
A commit references this bug:

Author: mandree
Date: Sat Mar 23 23:08:50 UTC 2019
New revision: 496692
URL: https://svnweb.freebsd.org/changeset/ports/496692

Log:
  rawtherapee: fix exit SIGABRT, enable OpenMP/i386

  Backport 'Explicitly destroy static Glib::RefPtr<>s on exit' from
  Hombre57's hidpi-icons branch in GitHub (now merged to dev branch).
  Also expose pixbufCache globally and explicitly .clear() it before exit().
  Fixes the SIGABRT-on-exit issue.

  Remove the wrapper that runs ulimit -c 0 before rawtherapee.

  Enable OpenMP on i386 (uses GCC for now).

  Shorten option descriptions so they don't get truncated.

  Only add -msse2 on i386 and amd64, to fix broken aarch64/powerpc64 builds.

  Fix various portlint warnings, removing USE_LDCONFIG.

  PR:		205370

Changes:
  head/graphics/rawtherapee/Makefile
  head/graphics/rawtherapee/files/patch-proper-cleanup-to-avoid-SIGABRT
  head/graphics/rawtherapee/files/run-rawtherapee.in
  head/graphics/rawtherapee/pkg-message
  head/graphics/rawtherapee/pkg-plist
Comment 18 Matthias Andree freebsd_committer freebsd_triage 2019-03-23 23:13:37 UTC
Test builds succeed on:
11.2-RELEASE arm64
11.2-RELEASE amd64
11.2-RELEASE i386
12.0-RELEASE amd64

Test run succeeds on:
12.0-RELEASE amd64

Note that i386 OpenMP support is experimental, and users are still encouraged to run rawtherapee on 64-bit computers with quite some horsepower and RAM.