<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - fontconfig update racy, causes update storm that freezes the desktop"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=100096">100096</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>fontconfig update racy, causes update storm that freezes the desktop
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>fontconfig
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>2.12
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>fontconfig-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jan.steffens@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>freedesktop@behdad.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Already posted as a gnome-settings-daemon bug at
<a href="https://bugzilla.gnome.org/show_bug.cgi?id=777255">https://bugzilla.gnome.org/show_bug.cgi?id=777255</a>

I'm trying to debug my desktop freezing often when I update fonts, and I think
I managed to reduce it to this:

1. Something changes ~/.local/share/fonts.

2. GSD notices and reinitializes fontconfig, which updates the cache.

3. GSD sends out an XSettings update.

2. Something changes ~/.local/share/fonts, again.

3. All other Gtk processes receive the XSettings update and reinitialize
fontconfig.  This includes the shell.

4. The processes all discover that ~/.local/share/fonts has changed and attempt
to update the cache. This needs a lock on the cache.

5. The processes wait on the lock, one by one rescanning the fonts in the dir.

Since the shell takes part, the desktop is frozen until the shell has finished
its rebuild. If the dir contains a lot of fonts and is slow to scan, the
desktop can be frozen for quite a while.

Running "touch abc; sleep 0.1; rm abc" in ~/.local/share/fonts quite reliably
freezes the shell for a second. Doing this in /usr/share/fonts/noto/ (which
contains the entire Noto set including CJK) freezes the desktop for over two
and a half minutes.

Maybe fontconfig can at least reduce the impact by rechecking whether the cache
is up-to-date after acquiring the lock? This way there should be only one
unexpected cache update instead of a dozen or more.

gnome-settings-daemon 3.22.1, GTK 3.22.6, fontconfig 2.12.1</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>