Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rake can be run on the wrong executor if concurrent builds are enabled #18

Open
rohanpm opened this issue Mar 21, 2014 · 0 comments
Open

Comments

@rohanpm
Copy link

rohanpm commented Mar 21, 2014

Rake can be scheduled on the wrong machine.

To reproduce:

  • Create a job with "Execute concurrent builds if necessary" enabled
  • Add build steps:
    • Shell build step: echo 'task(:default) { puts hostname; sleep 8 }' > Rakefile
    • A few rake build steps (e.g. 5) with all options as default
  • Ensure you have enough executors available, on different hosts, to run at least two instances of the job at once
  • Trigger the job several times
  • In the logs, observe that rake may switch between hosts during the build, as in the following example:
Started by user Rohan McGovern
Started by user Rohan McGovern
[EnvInject] - Loading node environment variables.
Building remotely on rmcgover-ws-02 (docker) in workspace /home/jenkins/workspace/rake test
[rake test] $ /bin/sh -xe /tmp/hudson1005075034362718171.sh
+ echo 'task(:default) { puts `hostname`; sleep 8 }'
[rake test] $ /usr/bin/rake
dd8166383c1d
[rake test] $ /usr/bin/rake
dd8166383c1d
[rake test] $ /usr/bin/rake
5ea60c3d5e02
[rake test] $ /usr/bin/rake
5ea60c3d5e02
[rake test] $ /usr/bin/rake
5ea60c3d5e02
[rake test] $ /usr/bin/rake
5ea60c3d5e02
Finished: SUCCESS

I'm not too familiar with Jenkins' APIs, but to me, this code in Rake.java looks suspicious:

    private Launcher getLastBuiltLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) {
        AbstractProject project = build.getProject();
        Node lastBuiltOn = project.getLastBuiltOn();
        Launcher lastBuiltLauncher = launcher;
        if (lastBuiltOn != null) {
            lastBuiltLauncher = lastBuiltOn.createLauncher(listener);
        }

        return lastBuiltLauncher;
    }

... since the value of project.getLastBuiltOn() presumably can change during a build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant