Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

MACOS agent doesn't run completely as specified user #2654

raimainc ·
In my agent.sh file on my MAC OS/X 10.7 machine, I have RUN_AS_USER set to build. When I run agent.sh start, it says I have to do that as root, so I use sudo to start it.

However, when I run my appledocs build that requires running certs & verifying identity, it fails, saying there is no identity.

If I run agent.sh console, then it does work. However, then the publish step fails. And it's not very convenient to keep a console up all the time to run quickbuild...

Any ideas on how to make this work?

Kevin
  • replies 14
  • views 4296
  • stars 0
robinshen ADMIN ·
Can you please check launched wrapper and Java processes of QB with "ps" command to see if it is running under the correct user?
raimainc ·
It does appear that they are all running under my "build" user. The UID for build is 726.

Running as service
skagit:~ build$ ps -ef | grep build
UID PID PPID
726 30052 1 0 8:57AM ?? 0:00.19 /bin/sh /opt/buildagent/bin/./agent.sh launchdinternal
726 30102 1 0 8:57AM ?? 0:00.06 /opt/buildagent/bin/./wrapper-macosx-universal-64 /opt/buildagent/bin/../conf/wrapper.conf wrapper.syslog.ident=quickbuild wrapper.pidfile=/opt/buildagent/bin/./quickbuild.pid wrapper.name=quickbuild wrapper.displayname=QuickBuild Build Agent wrapper.daemonize=TRUE wrapper.statusfile=/opt/buildagent/bin/./quickbuild.status wrapper.java.statusfile=/opt/buildagent/bin/./quickbuild.java.status wrapper.script.version=3.5.17
726 30103 30102 0 8:57AM ?? 0:16.29 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -d64 -Djava.awt.headless=true -Xverify:none -Xms64m -Xmx512m -Djava.library.path=.:./lib:../plugins/com.pmease.quickbuild.libs -classpath ../plugins/com.pmease.quickbuild.bootstrap:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-codec-1.3.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/wrapper.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-api-1.7.2.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/jul-to-slf4j-1.7.2.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/log4j-1.2.15.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/hessian-4.0.7.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/joda-time-2.0.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-logging-1.0.4.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/servlet-api-3.0.20100224.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-log4j12-1.7.2.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-io-1.4.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-lang-2.4.jar -Dwrapper.key=bs3UA3q3mMJCnt4kkQhTLwayfFAWRhVK -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.disable_console_input=TRUE -Dwrapper.pid=30102 -Dwrapper.version=3.5.17-st -Dwrapper.native_library=wrapper -Dwrapper.arch=universal -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=3600 -Dwrapper.jvmid=1 -Dwrapper.lang.domain=wrapper org.tanukisoftware.wrapper.WrapperStartStopApp com.pmease.quickbuild.bootstrap.Bootstrap 1 start com.pmease.quickbuild.bootstrap.Bootstrap FALSE 1 stop
726 30343 18155 0 8:57AM ttys001 0:00.00 grep build


Running as console
skagit:~ build$ ps -ef | grep build
UID PID PPID
726 41853 41849 0 9:31AM ttys000 0:00.00 grep build
726 41840 41791 0 9:31AM ttys001 0:00.06 /opt/buildagent/bin/./wrapper-macosx-universal-64 /opt/buildagent/bin/../conf/wrapper.conf wrapper.syslog.ident=quickbuild wrapper.pidfile=/opt/buildagent/bin/./quickbuild.pid wrapper.name=quickbuild wrapper.displayname=QuickBuild Build Agent wrapper.statusfile=/opt/buildagent/bin/./quickbuild.status wrapper.java.statusfile=/opt/buildagent/bin/./quickbuild.java.status wrapper.script.version=3.5.17
726 41841 41840 0 9:31AM ttys001 0:16.42 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -d64 -Djava.awt.headless=true -Xverify:none -Xms64m -Xmx512m -Djava.library.path=.:./lib:../plugins/com.pmease.quickbuild.libs -classpath ../plugins/com.pmease.quickbuild.bootstrap:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-codec-1.3.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/wrapper.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-api-1.7.2.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/jul-to-slf4j-1.7.2.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/log4j-1.2.15.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/hessian-4.0.7.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/joda-time-2.0.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-logging-1.0.4.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/servlet-api-3.0.20100224.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/slf4j-log4j12-1.7.2.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-io-1.4.jar:../plugins/com.pmease.quickbuild.bootstrap/lib/commons-lang-2.4.jar -Dwrapper.key=cshQ5RDlwcZQIapzEME27djM0UKBb_PJ -Dwrapper.port=32001 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=41840 -Dwrapper.version=3.5.17-st -Dwrapper.native_library=wrapper -Dwrapper.arch=universal -Dwrapper.cpu.timeout=3600 -Dwrapper.jvmid=1 -Dwrapper.lang.domain=wrapper org.tanukisoftware.wrapper.WrapperStartStopApp com.pmease.quickbuild.bootstrap.Bootstrap 1 start com.pmease.quickbuild.bootstrap.Bootstrap FALSE 1 stop


This is the top of th eerror output from the publish step when I run in console mode:
09:34:30,608 INFO - Checking step execute condition...
09:34:30,609 INFO - Step execute condition satisfied, executing...
09:34:30,738 INFO - Executing pre-execute action...
09:34:30,738 INFO - Running step...
09:34:30,946 INFO - Executing post-execute action...
09:34:30,946 ERROR - Step 'master>Documentation>Publish Docs' is failed: null
09:34:30,946 TRACE - Stack trace for the failure
com.pmease.quickbuild.RemotingException
at com.pmease.quickbuild.log.SecretAwareFileAppender.subAppend(SecretAwareFileAppender.java:12)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:856)
at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.log(Log4jMLog.java:161)
at com.mchange.v2.log.log4j.Log4jMLog$Log4jMLogger.log(Log4jMLog.java:164)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:538)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:78)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:147)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1026)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:176)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
at com.pmease.quickbuild.model.Build_$$_javassist_14.obfuscateSecrets(Build_$$_javassist_14.java)
at com.pmease.quickbuild.log.SecretAwareFileAppender.subAppend(SecretAwareFileAppender.java:14)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
robinshen ADMIN ·
Please upgrade to QB 5.1.8 and re-install your build agent running on MacOS to see if the problem can be solved.
raimainc ·
v5.1.8 does not fix this issue. The log files from the build machine are here:

ftp://ftp.raima.com/outgoing/skagit.qblogs.tar.gz
raimainc ·
I upgraded to v5.1.9 and it also does not fix this issue. The I've replaced the log files from the build machine here with the latest ones:

ftp://ftp.raima.com/outgoing/skagit.qblogs.tar.gz
robinshen ADMIN ·
I am a bit confused here. To my understanding, there are three issues right now:
1. the MacOS X RUN_AS_USER issue.
2. the publish step failing issue.
3. the db connection used up issue.

Do you mean that issue 1 and 2 still exist while issue 3 seems to be fixed? For issue 1 and issue 2, I am not see anything valueable from logs you sent to me, so can you please set up a WebEx or GotoMeeting session so that I can check the issue online?
raimainc ·
Only issue 1 continues to be a problem. Please contact me at ------------ or -----.------@raima.com to arrange a time for the GotoMeeting.
robinshen ADMIN ·
The MacOS X problem is a known issue, and this is a problem of the JSW (3rd party service wrapping library used by QB), and we've reported the issue to them. Will it work if you install agent as a service by running "service agent install", and restart your machine to have the agent running automatically?
raimainc ·
"service agent install" is not a recognized command. So far, I cannot get the buildagent to run on startup. Here's what I'm trying to do to get it to work. Please let me know what I'm doing wrong.

I run, from the buildagent/bin directory:

sudo ./agent.sh install
Installing the QuickBuild Build Agent daemon..
sudo ./agent.sh install
The QuickBuild Build Agent daemon is already installed.
sudo ./agent.sh start
Starting QuickBuild Build Agent. Detected Mac OSX and instlled launchd daemon.
Waiting for the QuickBuild Build Agent...

rebooted the machine.

Searched for the process:
ps -ef | grep build
And it shows nothing running

sudo ./agent.sh install
The QuickBuild Build Agent daemon is already installed.

./agent.sh start
Starting QuickBuild Build Agent. Detected Mac OSX and instlled launchd daemon.
Waiting for the QuickBuild Build Agent...
robinshen ADMIN ·
Sorry ought to be "agent.sh install" instead of "service agent install". Does the RUN_AS_USER defined in agent.sh has full permission over the agent directories and all sub-dir/files beneath it? If yes, please examine the "logs/console.log" to see if there are any errors.
raimainc ·
Sorry for the long delay, had other issues to deal with for a time.

I do use agent.sh install.
RUN_AS_USER is set to my build user
My build user has full ownership over the entire buildagent directory structure and subdirectories
The console.log file from the latest run is here: ftp://ftp.raima.com/outgoing/console.log
robinshen ADMIN ·
I saw from the log that there are some connection reset messages. Has this agent been started successfully and appeared in active node list of QB server?
raimainc ·
Yes. I can run the build on it just fine, it just doesn't seem to authenticate as my build user properly.
robinshen ADMIN ·
QB uses JSW for native service integration on various operating systems, and it currently is not able to load user specific environments although the service is set to run as specific user. So you might need to set up specific global environments to make it working the same way as in console mode.