<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - systemd gets stuck in loop with ConditionACPower in timer activated service"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=65818">65818</a>
          </td>
        </tr>

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

        <tr>
          <th>Summary</th>
          <td>systemd gets stuck in loop with ConditionACPower in timer activated service
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mus.svz@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=80900" name="attach_80900" title="backup service">attachment 80900</a> <a href="attachment.cgi?id=80900&action=edit" title="backup service">[details]</a></span>
backup service

I use the attached service and timer units for backup purposes. The service
file contains ConditionACPower=yes because I don't want the backup to run when
the power isn't plugged in.

This works as expected as long as the power is plugged in. If however the
service is triggered by the timer while the power is unplugged, systemd gets
stuck in a loop. CPU usage by systemd goes up to about 75%, systemd-journal up
to 35%, and the journal is flooded with the following message:

Jun 16 12:17:42 mus-laptop systemd[1]: Started Backup laptop

Every 10 seconds, the following is logged, followed by another few hundred
"Started backup-laptop" messages:

Jun 16 12:17:52 mus-laptop systemd-journal[178]: Suppressed 16332 messages from
/system
Jun 16 12:17:52 mus-laptop systemd[1]: Started Backup laptop.

Note that this doesn't happen when I trigger the service manually, only if it
is triggered by the timer. The loop stops as soon as I stop the timer.

"systemctl status backup-laptop" shows the following while it is stuck in the
loop:

backup-laptop.service - Backup laptop
   Loaded: loaded (/etc/systemd/system/backup-laptop.service; static)
   Active: inactive (dead) since Sun 2013-06-16 12:02:23 CEST; 21min ago
          start condition failed at Sun 2013-06-16 12:24:03 CEST; 2ms ago
 Main PID: 17667 (code=exited, status=0/SUCCESS)
   CGroup: name=systemd:/system/backup-laptop.service


I'm running Arch Linux x64 with systemd 204.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>