Ticket #694 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Infinite loop in the slave with Mercurial

Reported by: kalessin Owned by:
Priority: critical Milestone: 0.8.0
Version: 0.7.11 Keywords: slave, mercurial, infinite loop
Cc: macke@…, tyl.e.rod.er.kir.k@…

Description

Hello,

I have set up a buildbot for my first time (you do cool things !) and I have fallen into a nasty bug.

I'm using buidlbot (slave and master) on Debian squeeze with mercurial:

(chroot)root@kalessin:/tmp# buildbot --version
Buildbot version: 0.7.11p3
Twisted version: 9.0.0
(chroot)root@kalessin:/tmp# hg --version
Mercurial Distributed SCM (version 1.4.1)

Copyright (C) 2005-2009 Matt Mackall <mpm@selenic.com> and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(chroot)root@kalessin:/tmp# 

Whenever a new build was launched the slave started an infinite loop. The reason was here :

 http://github.com/djmitche/buildbot/blob/master/buildbot/slave/commands.py#L2915

You compare two directories paths, but done this way /foo/bar and /foo/bar/ appears to be differents. In my case when the condition was true, the slave restarted a complete checkout of the code, falling again in the condition, and again, and again, and again...

I have resolved the problem, by setting my repourl in my master.cfg without the ending slash :

from buildbot.process import factory
from buildbot.steps.source import Mercurial
from buildbot.steps.shell import Compile, Configure, Test
f1 = factory.BuildFactory()
f1.addStep(Mercurial(repourl="/tmp/zia"))
f1.addStep(Configure(command=["cmake", "."])) # do not use configure
f1.addStep(Compile()) # make all
f1.addStep(Test()) # make test

A more robust way to compare directories paths should be used.

Please, find the log from both the slave and the master attached with this ticket. (due to the loop I have truncated them).

Best Regards -- Louis Opter <kalessin@…>

Attachments

twistd.log.slave Download (153.6 KB) - added by kalessin 3 years ago.
Log file from the slave
twistd.log.master Download (44.9 KB) - added by kalessin 3 years ago.
Log file from the master

Change History

Changed 3 years ago by kalessin

Log file from the slave

Changed 3 years ago by kalessin

Log file from the master

comment:1 Changed 3 years ago by kalessin

  • Version changed from 0.7.12 to 0.7.11

Correct version number.

comment:2 Changed 3 years ago by kalessin

  • Summary changed from Infinite loop int the slave with Mercurial to Infinite loop in the slave with Mercurial

Correct the title...

comment:3 Changed 3 years ago by marcusl

  • Cc macke@… added

Good catch.

Could you check if this is still present in 0.7.12? IIRC some work was done the comparison code, but I'm not sure whether this bug was affected.

comment:4 Changed 3 years ago by marcusl

Try to add this before the comparison, to remove trailing slashes from either path:

   oldurl = oldurl.rstrip('/')
   newurl = oldurl.rstrip('/')

comment:5 Changed 3 years ago by marcusl

bah.. obvious typo there.. and no edit of comments.. sigh..

comment:6 Changed 3 years ago by Dustin J. Mitchell

  • Status changed from new to closed
  • Resolution set to fixed

compare mercurial repos without trailing slashes (fixes #694)

This simply strips the trailing slashes from the repositories before comparing the strings. This may be covering up a deeper problem, though.

Changeset: f45d016cf0f47dfbb16d1117c1f5ebe1141f8026

comment:7 Changed 3 years ago by dustin

  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Milestone changed from ongoing to 0.8.0

Well, let me know if this fixed it - it's just a more subtle version of marcus's patch.

comment:8 Changed 3 years ago by marcusl

It's probably nothing more than the fact that the slash is appended/removed by Mercurial and users can specify with or without, and it still works.

comment:9 Changed 3 years ago by tyleroderkirk

  • Cc tyl.e.rod.er.kir.k@… added

I encountered an infinite loop similar to the submitter's on Ubuntu 9.04 with Buildbot 0.7.12 while trying to build code from a local Mercurial repository.

Dustin's patch above (changeset:f45d016cf0f47dfbb16d1117c1f5ebe1141f8026) didn't resolve it but changing the repository URL in my master.cfg from "file:///var/lib/foo" to "/var/lib/foo" did.

So, I'm all set, but shout if you need any more details.

comment:10 Changed 3 years ago by marcusl

Right. We should strip  file:// from both URLs that we compare with, not just the one that hg gives us.

And there should be some protection against infinite loops anyway.

comment:11 Changed 3 years ago by Marcus Lindblom

Avoid infinite recursion in Mercurial step (see #694)

Changeset: ad4a73471d2f3c5147ef1c4bc5717c7919502123

comment:12 Changed 3 years ago by marcusl

  • Status changed from reopened to closed
  • Resolution set to fixed

Fix Mercurial repo URL comparison for clobber (fixes #694)

Changeset: 60b285b6efa45e8dbdaea542a64b354207aecae9

comment:13 Changed 3 years ago by Marcus Lindblom

Avoid infinite recursion in Mercurial step (see #694)

Changeset: ad4a73471d2f3c5147ef1c4bc5717c7919502123

Note: See TracTickets for help on using tickets.