darktable icon indicating copy to clipboard operation
darktable copied to clipboard

Crash when switching from lighttable to darkroom mode and when starting/closing program

Open clavinet opened this issue 2 years ago • 10 comments

To Reproduce

  1. open darktable
  2. open image from library
  3. go back to lighttable mode
  4. open image again
  5. darktable crashes

Other ways to reproduce:

  • start darktable
  • close darktable

Platform

  • darktable version : 3.8.1 (official distro package)
  • OS : openSUSE Tumbleweed 20220403
  • Memory : 32 GiB
  • Graphics card : AMD RX 570
  • Graphics driver : amdgpu (OSS)
  • OpenCL installed : no
  • OpenCL activated : no
  • Xorg : 21.1.3
  • Desktop : Plasma 5.24.4
  • GTK+ : 3.24.33
  • gcc : 11-6.1
  • cflags : unknown
  • CMAKE_BUILD_TYPE : RELWITHDEBINFO

Additional context

  • Can you reproduce with another darktable version(s)? unavailable

  • Can you reproduce with a RAW or Jpeg or both? yes, both

  • Are the steps above reproducible with a fresh edit (i.e. after discarding history)? yes

  • Is the issue still present using an empty/new config-dir (e.g. start darktable with --configdir "/tmp")? yes

  • Do you use lua scripts? no

I get these messages in stdout

corrupted size vs. prev_size free(): invalid pointer free(): invalid next size (fast) realloc(): invalid pointer

It's a random one from these every time it crashes.

Edit: I also get one of these messages when I just open and close darktable. Edit: sometimes I also get a crash with these messages when launching darktable.

clavinet avatar Apr 09 '22 18:04 clavinet

I got three backtraces now, from switching between lighttable and darkroom mode:

darktable_bt_4HXDK1.txt darktable_bt_6U5NK1.txt darktable_bt_SW3PK1.txt

clavinet avatar Apr 09 '22 19:04 clavinet

Most of the time, such issues are due to buggy OpenCL drivers. And AMD ones are known to be. So probably not a darktable issue but an OpenCL driver one. Try to disable OpenCL in main preferences of darktable (processing tab) or by adding --disable-opencl to command launcher.

It you no more have issue after disabling OpenCL, please think about reporting it here and close your issue.

Nilvus avatar Apr 10 '22 07:04 Nilvus

@Nilvus you are aware that OpenCl was disabled in the report? Also there have been quite a number of dt bugfixes for amd drivers in master ...

jenshannoschwalm avatar Apr 10 '22 11:04 jenshannoschwalm

@Nilvus you are aware that OpenCl was disabled in the report? Also there have been quite a number of dt bugfixes for amd drivers in master ...

No, I didn't check that. We have had many issues like that one related to OpenCL on Amd or Intel. And few users ha such issue. So if it's something else, I just removed label and let other people see if they see something else.

Nilvus avatar Apr 10 '22 12:04 Nilvus

I had removed OpenCL already.

$ clinfo
Number of platforms                               0

I still get these errors with a clean test config:

$ darktable --configdir /ramdisk/darktable

Just did an upgrade to the latest distro snapshot too. System: Operating System: openSUSE Tumbleweed 20220409 KDE Plasma Version: 5.24.4 KDE Frameworks Version: 5.92.0 Qt Version: 5.15.2 Kernel Version: 5.17.1-1-default (64-bit) Graphics Platform: X11 Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor Memory: 31.3 GiB of RAM Graphics Processor: AMD Radeon RX 570 Series

I also get these same error messages on another machine: Operating System: openSUSE Tumbleweed 20220409 KDE Plasma Version: 5.24.4 KDE Frameworks Version: 5.92.0 Qt Version: 5.15.2 Kernel Version: 5.16.14-1-default (64-bit) Graphics Platform: X11 Processors: 8 × AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx Memory: 14.5 GiB of RAM Graphics Processor: AMD Radeon Vega 8 Graphics

clavinet avatar Apr 11 '22 17:04 clavinet

I'm having a similar problem with dt master.

I'm not sure when it started happening (maybe few weeks ago) but now I can't go past few clicks before dt crashes with one of these messages:

  • realloc(): invalid next size
  • corrupted size vs. prev_size
  • free(): invalid pointer
  • free(): invalid next size (fast)
  • ...

A reproducer:

  • darktable --configdir newdir (where newdir does not exist)
  • expand export module and type something in set size e.g. 1000
  • close dt
  • core dumped with one of the above messages

In the current state dt is unusable.

Since it doesn't look that many people are affected, there might be the possibility that the problem lies with the openSUSE built.

dt: 3.9.0~git1261.18394dce05 from openSUSE os: openSUSE tumbleweed 20220420 x86_64 cpu: intel graphic card: integrated opencl: no

lbilli avatar Apr 22 '22 19:04 lbilli

I'm also affected esp. with my old cache. Darktable crashes upon start frequently with free(): invalid pointer error, while removing ~/.cache/darktable and ~/.config/darktable makes it more stable.

I can also reproduce all the errors mentioned above with lbllll 's instruction, with one extra error double free or corruption (!prev).

OS: Archlinux Darktable (pacman version): 2:3.8.1-4 CPU: AMD Ryzen 7 5800H with Radeon Graphic Graphic card: Integrated Kernel: Linux 5.17.7-arch1-1

darktable --version
❯  darktable --version
this is darktable 3.8.1
copyright (c) 2009-2022 johannes hanika
[email protected]

compile options:
  bit depth is 64 bit
  normal build
  SSE2 optimized codepath enabled
  OpenMP support enabled
  OpenCL support enabled
  Lua support enabled, API version 8.0.0
  Colord support enabled
  gPhoto2 support enabled
  GraphicsMagick support enabled
  ImageMagick support disabled
  OpenEXR support enabled
darktable-cltest
❯  darktable-cltest
0.018892 [opencl_init] opencl related configuration options:
0.018913 [opencl_init]
0.018917 [opencl_init] opencl: 1
0.018921 [opencl_init] opencl_scheduling_profile: 'default'
0.018924 [opencl_init] opencl_library: ''
0.018928 [opencl_init] opencl_memory_requirement: 768
0.018933 [opencl_init] opencl_memory_headroom: 400
0.018937 [opencl_init] opencl_device_priority: '*/!0,*/*/*/!0,*'
0.018945 [opencl_init] opencl_mandatory_timeout: 400
0.018951 [opencl_init] opencl_size_roundup: 16
0.018954 [opencl_init] opencl_async_pixelpipe: 0
0.018957 [opencl_init] opencl_synch_cache: active module
0.018962 [opencl_init] opencl_number_event_handles: 25
0.018966 [opencl_init] opencl_micro_nap: 1000
0.018969 [opencl_init] opencl_use_pinned_memory: 0
0.018971 [opencl_init] opencl_use_cpu_devices: 0
0.018975 [opencl_init] opencl_avoid_atomics: 0
0.018977 [opencl_init]
0.019266 [opencl_init] found opencl runtime library 'libOpenCL'
0.019297 [opencl_init] opencl library 'libOpenCL' found on your system and loaded
0.019314 [opencl_init] could not get platforms: -1001
0.019321 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
0.019326 [opencl_init] initial status of opencl enabled flag is OFF.

I think it is probably resulted from upstream changes, as I did not run into any errors during my last run in 12th March, when darktable should still be at 3.8.1 but built with older dependencies (pacman version is 3.8.1-2).

Some possible breaking dependencies
# direct dependencies that had an update from 12th March to 10th April
pugixml 1.11.4-1 -> 1.12.1-1
colord-gtk 0.3.0-1 -> 0.3.0-2
graphicsmagick 1.3.38-1 -> 1.3.38-2
libsecret 0.20.5-1 -> 0.20.5-2

# direct dependencies with major version bump
libavif 0.9.3-1 -> 0.10.1-1 (26th April)

Just for informational purposes as I am not sure if the bug is caused by these direct dependencies or higher ones (e.g. glibc).

Pinging @Nilvus if you have any ideas.

heyrict avatar May 16 '22 08:05 heyrict

got another one switching to lighttable darktable_bt_JOD8M1.txt

clavinet avatar May 28 '22 09:05 clavinet

Switching modes has a 60%+ chance of crashing.

I'm on 3.8.1 and for me, it always ends up with a locked database warning upon re-opening DT. I have also tried 3.9.0.r1765.g304038b808-1. Same issue, but at least the database doesn't lock.

image

epistularum avatar Jun 17 '22 20:06 epistularum

An update: I haven't experienced any of these crashes in a while and the repro above works fine now.

Not sure what did it, but since maybe around the 4.0 release dt master has been rather stable for me.

lbilli avatar Jul 30 '22 22:07 lbilli

This issue did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

github-actions[bot] avatar Sep 29 '22 00:09 github-actions[bot]

Same thing for me. I am on 4.0 and not experiencing this issue anymore.

epistularum avatar Sep 29 '22 01:09 epistularum

So closing by now.

Nilvus avatar Sep 30 '22 18:09 Nilvus