darktable-org / darktable-org/darktable

sync issue boolean and gui->reset

Open
#21,296 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13.1k
Forks
1.4k
Avg merge
22h 14m
Merged PRs (30d)
198

Description

In the lighttable view, the thread was 'worker' and 'thumbs_update*'.

It looks to me like the darktable thread and thumbs_update can run in parallel. When I run dt 5.4.1 in gdb and set an awatch on darktable.gui->reset I see stuff like this

Thread 1 "darktable" hit Hardware access (read/write) watchpoint 1: darktable.gui->reset

Value = 0

Thread 1 "darktable" hit Hardware access (read/write) watchpoint 1: darktable.gui->reset

Value = 0
0x00007ffff7af91ff in dt_view_image_get_surface (imgid=304, width=98, height=80, surface=surface@entry=0x7fffffff6fd0, quality=quality@entry=0) at /home/david/devel/darktable/darktable/src/views/view.c:727
727       *surface = NULL;
[Switching to Thread 0x7fffe59fe6c0 (LWP 777633)]

Thread 20 "thumbs_update" hit Hardware access (read/write) watchpoint 1: darktable.gui->reset

Old value = 0
New value = 1

Thread 20 "thumbs_update" hit Hardware access (read/write) watchpoint 1: darktable.gui->reset

Value = 1
dt_iop_reload_defaults (module=0x7fff9800afd0) at /home/david/devel/darktable/darktable/src/develop/imageop.c:1299
1299      if(module->reload_defaults)
[Switching to Thread 0x7fffef1a4f40 (LWP 777612)]

Thread 1 "darktable" hit Hardware access (read/write) watchpoint 1: darktable.gui->reset

Value = 1

Thread 1 "darktable" hit Hardware access (read/write) watchpoint 1: darktable.gui->reset

Value = 1

Without synchronised access to darktable.gui->reset those two threads (and maybe others?) are bound to get tangled up, aren't they?

Originally posted by @dhoulder in #21043

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining darktable.gui-reset accesses around dt_view_image_get_surface in src/views/view.c and dt_iop_reload_defaults in src/develop/imageop.c. Reproduce the reported watchpoint activity under gdb, identify all participating threads and accesses, and consider the issue done when the shared state is accessed safely without the reported race.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.