Issue Details (XML | Word | Printable)

Key: BAM-2321
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Brydie McCoy [Atlassian]
Reporter: Brydie McCoy [Atlassian]
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Bamboo

Perforce failing to connect on agent

Created: 02/Mar/08 05:37 PM   Updated: 01/Apr/08 07:10 PM
Component/s: Agents (Remote), Repository (Perforce)
Affects Version/s: 2.0 beta 3
Fix Version/s: 2.0 beta 4, 2.0

Time Tracking:
Original Estimate: 4 hours
Original Estimate - 4 hours
Remaining Estimate: 0 minutes
Time Spent - 3 hours
Time Spent: 3 hours
Time Spent - 3 hours Time Not Required

Participants: Brydie McCoy [Atlassian] and Thomas Wehner
Since last comment: 31 weeks, 5 days ago
Number of comments: 3
Internal Priority: 1. Highest
Labels:


 Description  « Hide
From forum post: http://forums.atlassian.com/thread.jspa?threadID=23937&tstart=0

Hi,

we are trying to use Bamboo 2.0 Beta 3 together with a Perforce repository. We have set up a remote agent and a build plan accessing the repository but we can't get the agent to synchronize the sources. It invariably fails with the error message

Connect to server failed; check $P4PORT

When you check the log files you see that the agent issues a command of the form

C:/Programs/Perforce/p4.exe workspace -o <client_name>

which causes the error to occur. When you execute the same command manually on the agent machine it works just fine. We tried various workarounds like setting the P4PORT variable either locally in the script that starts the agent or globally in the system environment but to no avail. In principle the Perforce server access data should be transmitted from the Bamboo server (where they are stored in the plan configuration) to the agent but that does not seem to be the case.

Any help in this matter would be greatly appreciated.

Thomas



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brydie McCoy [Atlassian] added a comment - 02/Mar/08 06:39 PM
From Thomas:

Some rather lengthy debugging sessions revealed that the root cause of the problem seems to be that the system environment is transferred from the server to the agent. In our case the server is running on XP and the agent on W2K. When the perforce process was spawned on the agent machine the 'SystemRoot' variable had the (XP) value 'C:\WINDOWS' instead of the W2K value 'C:\WINNT' which seems to cause all sorts of strange behavior (such as inability to resolve the perforce server or 'WSAEPROVIDERFAILEDINIT' errors when trying to connect to the server). Using a wrapper script which sets the variable to the correct value before executing the actual p4 process solved the problem. Evidently, this is only a workaround and the problem should be fixed for the release version.


Thomas Wehner added a comment - 03/Mar/08 03:22 AM
The error messages written to the log file were always of the following form:

2008-02-28 15:39:55,566 INFO [BAM::10.11.11.234::Agent] [BuildAgentControllerImpl] Build TST-AM-1 started building on agent 10.11.11.234
INFO | jvm 1 | 2008/02/28 15:39:55 | 2008-02-28 15:39:55,566 INFO [BAM::10.11.11.234::Agent] [DefaultBuildAgent] Running build task: com.atlassian.bamboo.v2.build.task.CheckoutUpdateForBuild
INFO | jvm 1 | 2008/02/28 15:39:55 | 2008-02-28 15:39:55,656 INFO [BAM::10.11.11.234::Agent] [CheckoutUpdateForBuild] Updating source code to latest
INFO | jvm 1 | 2008/02/28 15:39:55 | 2008-02-28 15:39:55,906 INFO [BAM::10.11.11.234::Agent] [CmdLineExecutor] Executing: C:/Programs/Perforce/p4.exe workspace -o bamboo_02l013-2_NavAppsTrunk_ApplicationManager
INFO | jvm 1 | 2008/02/28 15:39:56 | 2008-02-28 15:39:56,137 WARN [BAM::10.11.11.234::Agent] [BuildAgentControllerImpl] Error occurred while executing the build for TST-AM-1
INFO | jvm 1 | 2008/02/28 15:39:56 | com.atlassian.bamboo.repository.RepositoryException: Connect to server failed; check $P4PORT
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.repository.perforce.PerforceManager.setupSync(PerforceManager.java:121)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.repository.perforce.PerforceRepository.retrieveSourceCode(PerforceRepository.java:154)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.v2.build.task.CheckoutUpdateForBuild.call(CheckoutUpdateForBuild.java:62)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:186)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:68)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:100)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$1.run(NamedThreadFactory.java:32)
INFO | jvm 1 | 2008/02/28 15:39:56 | at edu.emory.mathcs.backport.java.util.concurrent.helpers.ThreadHelpers$1.run(ThreadHelpers.java:34)
INFO | jvm 1 | 2008/02/28 15:39:56 | at java.lang.Thread.run(Thread.java:619)
INFO | jvm 1 | 2008/02/28 15:39:56 | Caused by: com.tek42.perforce.PerforceException: Connect to server failed; check $P4PORT
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:218)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.tek42.perforce.parse.Workspaces.getWorkspace(Workspaces.java:26)
INFO | jvm 1 | 2008/02/28 15:39:56 | at com.atlassian.bamboo.repository.perforce.PerforceManager.setupSync(PerforceManager.java:102)
INFO | jvm 1 | 2008/02/28 15:39:56 | ... 8 more

The actual error messages from the p4 executable were truncated in the log file. Initially, when we had indicated the perforce server port as 'perforce:1666' ('perforce' being the name of the server machine) the full error message was:

Perforce client error:
Connect to server failed; check $P4PORT.
TCP connect to perforce failed.
perforce: host unknown.

To work around this problem we changed the port definition in the plan configuration to '<ip_address>:1666' only to end up with the following error:

Perforce client error:
Connect to server failed; check $P4PORT.
TCP connect to <ip_address>:1666 failed.
socket: <ip_address>:1666: WSAEPROVIDERFAILEDINIT

This error message put us on the right track substituting a custom script in the agent's perforce capability for the actual p4 executable which works as described above:

@set SystemRoot=C:\WINNT
@C:\Programs\Perforce\p4.exe %*

Now it works fine. Interestingly, the problem seems to occur only with the source code synchronization and not with the actual building step.


Brydie McCoy [Atlassian] added a comment - 03/Mar/08 04:46 PM
Hi Thomas,

Thanks for your help. It seems the perforce library was putting in an arbitrary default value for the SystemRoot value. This has been amended, so it should now get the SystemRoot from your environment variables instead.

This fix will be going out in the next beta release along with improved logging from Perforce.

Cheers,
Brydie