Skip to content

Slow interaction between backgrounding, universal variables, and repainting #8209

Closed

Description

@IlanCosman

fish, version 3.3.1
Linux arch 5.13.7-arch1-1 #1 SMP PREEMPT Sat, 31 Jul 2021 13:18:52 +0000 x86_64 GNU/Linux

First, I do not expect anyone to work on this. It is a largely frivolous bug that effects very few users.
I've been sitting on it for a while, but decided I might as well put it here for informational purposes.

Clean fish, with the following defined in fish_prompt.fish:

# Defined in fish_prompt.fish
function _refresh_prompt --on-variable foo
    commandline --function repaint
end

function fish_prompt
    fish --command "set -U foo $PWD" &
    echo $foo
end

Here's what it looks like in Fish 3.2.2:

repainting-fast-3.2.2.mp4

In Fish 3.3.1 there seems to be a few hundred millisecond lag:

repainting-slow-3.3.1.mp4

Weirdly enough, this works in Fish 3.3.1, and is perfectly responsive:

backgrounding-working-in-other-shell.mp4

Maybe this means the bug has something to do with pgroups?


Alright so there it is. Unfortunately, I wasn't able to bisect the bug because of a separate bug that happened in between, #8088

Activity

  1. faho commented on Aug 13, 2021

    @faho
    Member
  2. ridiculousfish commented on Sep 16, 2021

    @ridiculousfish
    Member

    The issue here is that we are spawning an instance of fish which sets a uvar and then immediately exits. On Linux, uvar changes are broadcast by writing some data to a pipe, waiting a bit, and then reading it back, but there's no way to read it back if fish has exited. This means data is left on the pipe, so we stay in "polling mode" longer and the poll interval is 100 msec. Well I guess we can reduce it to 10 msec.

  3. IlanCosman commented on Sep 16, 2021

    @IlanCosman
    ContributorAuthor

    No way! You're actually working on it, what a legend! I really, truly appreciate it ❤️
    I swear once I take my intro to C class next quarter, I'll try to stop being such a bothersome moocher and start contributing 😄

    writing some data to a pipe, waiting a bit, and then reading it back

    Forgive my ignorance, but why do we need to read it back? After all, we're the ones who just sent it, so we know what it says 😄

  4. ridiculousfish commented on Sep 16, 2021

    @ridiculousfish
    Member

    d607588 should reduce the max delay from 100 msec to 10 msec. I think this is the best we can easily do. Thanks for filing.

  5. added this to the fish 3.4.0 milestone on Sep 16, 2021
  6. added a commit that references this issue on Dec 12, 2021
  7. locked as resolved and limited conversation to collaborators on Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions