swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.45k stars 1.1k forks source link

Transaction times out while killing parent container of a split #5801

Open Xyene opened 3 years ago

Xyene commented 3 years ago

On Sway master:

Transaction times out and V[] is displayed as the container representation for a bit (200ms by default).

Logs say:

00:12:34.973 [sway/desktop/transaction.c:428] Transaction 0x5573043a6550 committing with 10 instructions
00:12:34.973 [sway/desktop/transaction.c:281] Applying transaction 0x5573043a6550
00:12:35.674 [sway/desktop/transaction.c:428] Transaction 0x557303aab880 committing with 8 instructions
00:12:35.674 [sway/desktop/transaction.c:281] Applying transaction 0x557303aab880
00:12:36.170 [sway/desktop/transaction.c:428] Transaction 0x557303c49af0 committing with 8 instructions
00:12:36.370 [sway/desktop/transaction.c:389] Transaction 0x557303c49af0 timed out (3 waiting)
00:12:36.370 [sway/desktop/transaction.c:281] Applying transaction 0x557303c49af0

/cc @RPigott from https://github.com/swaywm/sway/pull/5756#issuecomment-725202347

rpigott commented 3 years ago

So I'm beginning to look into these transaction issues more and one thing I can quickly notice is that only some container properties are duplicated in the container_state struct.

The renderer references the title in the container struct whereas for most other properties it references container.current of type container_state which is used as a pending state. container_state doesn't currently have a title field for some reason, but I think title will need to be double buffered to correct the rendering bug. I have to wonder if we can't just have a single struct holding all the container state then have copies of it like current and pending, similar to wlroots's wlr_surface.

As for why there is a transaction time out... I think that when we send close to the parent container and each child gets a simultaneous close, the first call to view_unmap begins a transaction that will wait for the sibling client(s) to ack a configure, but it doesn't bother because its just been closed.

As evidence, here are some easy steps to reproduce a transaction time-out:

  1. open a $term and float it
  2. swaymsg resize grow width 20px, kill
  3. transaction timeout before it closes.

I think I will examine what happens to transactions on client close in more detail later.