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

Launch encountered an unknown exception #2525

Closed
barrowkwan opened this issue Aug 3, 2016 · 12 comments

Comments

Projects
None yet
7 participants
@barrowkwan
Copy link

commented Aug 3, 2016

Bug Report

Create a new agent with 16.2 installed ( agent has not connect to the GoCD server yet ), then point to GoCD experimental yum repos to upgrade agent to 16.8. Configure the agent to connect to the Go server ( also on 16.8 ) and got this error:

2016-08-03 14:26:30,051 [TouchLoopThread-5] INFO  go.agent.launcher.Lockfile:102 - Using lock file: /var/lib/go-agent/.agent-bootstrapper.running
2016-08-03 14:26:41,179 [main     ] ERROR cruise.agent.launcher.AgentLauncherImpl:98 - Launch encountered an unknown exception
java.lang.NullPointerException
           at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.getPort(AgentLauncherImpl.java:136)
           at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.getUrlGenerator(AgentLauncherImpl.java:127)
           at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.launch(AgentLauncherImpl.java:75)
           at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.go(AgentBootstrapper.java:72)
           at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.main(AgentBootstrapper.java:54)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.simontuffs.onejar.Boot.run(Boot.java:306)
           at com.simontuffs.onejar.Boot.main(Boot.java:159)
2016-08-03 14:26:41,188 [TouchLoopThread-8] INFO  go.agent.launcher.Lockfile:102 - Using lock file: /var/lib/go-agent/.agent-bootstrapper.running

The error has gone after rename agent-launcher.jar and restart go-agent.

@barrowkwan barrowkwan added this to the Release 16.8 milestone Aug 3, 2016

@ketan

This comment has been minimized.

Copy link
Member

commented Aug 4, 2016

Workaround while we fix this issue —

  • stop the go-agent
  • remove the file agent-launcher.jar and agent.jar. These files are usually located in /var/lib/go-agent on linux, and in C:\Program Files (x86)\Go Agent for windows.
  • start the go-agent
@padmam

This comment has been minimized.

Copy link

commented Aug 4, 2016

Another customer facing this issue, below are the details

I installed the latest version of Go Agent, changed the setting setting accordingly as specified in the help page. Bt when I start the go agent as service i am getting the below exception:

2016-08-04 13:27:14,543 [main ] ERROR cruise.agent.launcher.AgentLauncherImpl:98 - Launch encountered an unknown exception
java.lang.NullPointerException
at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.getPort(AgentLauncherImpl.java:136)
at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.getUrlGenerator(AgentLauncherImpl.java:127)
at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.launch(AgentLauncherImpl.java:75)
at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.go(AgentBootstrapper.java:72)
at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.main(AgentBootstrapper.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.simontuffs.onejar.Boot.run(Boot.java:306)
at com.simontuffs.onejar.Boot.main(Boot.java:159)
2016-08-04 13:27:14,547 [TouchLoopThread-2] INFO go.agent.launcher.Lockfile:102 - Using lock file: /var/lib/go-agent/.agent-bootstrapper.running

I am running both Server and agent on Ubuntu 14.04.

@steveyang95

This comment has been minimized.

Copy link

commented Aug 4, 2016

@ketan I followed your suggestion and deleted agent-launcher.jar (there was no agent.jar for me), started the agent, and I get the following error. I am currently working on an ec2-instance linux based.

2016-08-04 17:39:58,302 [TouchLoopThread-65] INFO  go.agent.launcher.Lockfile:102 - Using lock file: /var/lib/go-agent/.agent-bootstrapper.running
2016-08-04 17:39:58,302 [main     ] ERROR cruise.agent.launcher.AgentLauncherImpl:98 - Launch encountered an unknown exception
java.lang.NullPointerException
        at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.getPort(AgentLauncherImpl.java:136)
        at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.getUrlGenerator(AgentLauncherImpl.java:127)
        at com.thoughtworks.cruise.agent.launcher.AgentLauncherImpl.launch(AgentLauncherImpl.java:75)
        at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.go(AgentBootstrapper.java:72)
        at com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.main(AgentBootstrapper.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.simontuffs.onejar.Boot.run(Boot.java:306)
        at com.simontuffs.onejar.Boot.main(Boot.java:159)
@arvindsv

This comment has been minimized.

Copy link
Member

commented Aug 4, 2016

@steveyang95: Till @ketan gets a chance to take a look at this, I thought I'd confirm a few things:

  1. Is the installed agent a 16.7 agent? [rpm -q go-agent OR dpkg -l go-agent]
  2. Is the installer server a 16.7 server? [rpm -q go-server OR dpkg -l go-server]

With this setup, when you stop the agent, remove /var/lib/go-agent/agent-launcher.jar (and, /var/lib/go-agent/agent.jar if it exists) and bring it back up, it still says the same thing??

@steveyang95

This comment has been minimized.

Copy link

commented Aug 4, 2016

@arvindsv Should have specified. The agent is 16.7, but the server is 16.3. And yes to your last question. Should the server and agent be same version?

@arvindsv

This comment has been minimized.

Copy link
Member

commented Aug 4, 2016

@steveyang95: Yes and no. 16.7 agent with 16.3 server won't work. Usually, the server version should be higher than that of the agent. It's a little complicated to explain - the installed agent is called the "bootstrapper" and its job is to upgrade the real agent to the version that the server needs.

So, if your installed agent is 16.2 and the server is upgraded to 16.3, then the 16.2 bootstrapper will download the 16.3 agent and use it. Usually, that works fine. Even if you install a 16.4 agent and use it with a 16.3 server, it (the agent bootstrapper) will try and downgrade the agent to 16.3 and use it. This works most times. In 16.7, it won't because of a change in the interface.

In this case, what's happening is that the 16.7 bootstrapper is expecting the 16.7 agent (from the 16.7 server) and instead gets a 16.3 agent from the 16.3 server. If you had a 16.6 agent, it would have worked. 16.7 has made some changes to enable end-to-end TLS verification and won't work with a 16.3 server.

I said it's confusing. :)

Here are some version combinations which should work:

16.1 agent with 16.3 server.
16.2 agent with 16.3 server.
16.3 agent with 16.3 server.
16.4 agent with 16.3 server (not recommended).
16.5 agent with 16.3 server (not recommended).
16.6 agent with 16.3 server (not recommended).

16.5 agent with 16.7 server (you won't be able to use end-to-end TLS)
16.6 agent with 16.7 server (you won't be able to use end-to-end TLS)
16.7 agent with 16.7 server (recommended).

@steveyang95

This comment has been minimized.

Copy link

commented Aug 4, 2016

@arvindsv I see thank you for the explanation! I will try to download the 16.3 agent. Is there any way to use the apt-get command to directly download the correct version of the agent, or do I have to manually transfer files (such as the deb file) to the ec2 instance? Currently, the commands that are listed in the documentation retrieve the latest version of the agent. Also is there a method to uninstall the current installed agent, or does that have to be done manually as well?

@arvindsv

This comment has been minimized.

Copy link
Member

commented Aug 4, 2016

Sure. This can be done using using dpkg/apt commands (as with any package on a debian installation). Here's an example of a session which downgrades the agent:

$ dpkg -l go-agent
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                   Version                  Architecture             Description
+++-======================================-========================-========================-==================================================================================
ii  go-agent                               16.7.0-3819              all                      Go Agent Component

$ apt-get remove go-agent
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  ca-certificates-java java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfreetype6 libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3
  libnss3-nssdb libpng12-0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxi6 libxrender1 libxtst6 openjdk-9-jre-headless x11-common
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  go-agent
0 upgraded, 0 newly installed, 1 to remove and 23 not upgraded.
After this operation, 5458 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 8542 files and directories currently installed.)
Removing go-agent (16.7.0-3819) ...
invoke-rc.d: policy-rc.d denied execution of stop.
Processing triggers for systemd (229-4ubuntu6) ...

$ ls /var/lib/go-agent/
log4j.properties

$ apt-cache madison go-agent
  go-agent | 16.7.0-3819 | https://download.go.cd  Packages
  go-agent | 16.6.0-3590 | https://download.go.cd  Packages
  go-agent | 16.5.0-3305 | https://download.go.cd  Packages
  go-agent | 16.4.0-3223 | https://download.go.cd  Packages
  go-agent | 16.3.0-3183 | https://download.go.cd  Packages
  go-agent | 16.2.1-3027 | https://download.go.cd  Packages
  go-agent | 16.1.0-2855 | https://download.go.cd  Packages
  go-agent | 15.2.0-2248 | https://download.go.cd  Packages
  go-agent | 15.1.0-1863 | https://download.go.cd  Packages
  go-agent | 14.4.0-1356 | https://download.go.cd  Packages
  go-agent | 14.3.0-1186 | https://download.go.cd  Packages
  go-agent | 14.2.0-377 | https://download.go.cd  Packages
  go-agent | 14.1.0-18882 | https://download.go.cd  Packages
  go-agent | 13.4.1-18342 | https://download.go.cd  Packages
  go-agent | 13.4.0-18334 | https://download.go.cd  Packages
  go-agent | 13.3.1-18130 | https://download.go.cd  Packages
  go-agent | 13.2.2-17585 | https://download.go.cd  Packages
  go-agent | 13.1.1-16714 | https://download.go.cd  Packages

$ apt-get install go-agent=16.3.0-3183
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  go-agent
0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded.
Need to get 3569 kB of archives.
After this operation, 5243 kB of additional disk space will be used.
Get:1 https://download.go.cd  go-agent 16.3.0-3183 [3569 kB]
Fetched 3569 kB in 1s (2732 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package go-agent.
(Reading database ... 8532 files and directories currently installed.)
Preparing to unpack .../go-agent_16.3.0-3183_all.deb ...
'Go Agent' installation will now use group 'go'
'Go Agent' installation will now use user 'go'
Unpacking go-agent (16.3.0-3183) ...
Processing triggers for systemd (229-4ubuntu6) ...
Setting up go-agent (16.3.0-3183) ...
Installing new version of config file /etc/default/go-agent ...
Found Java /usr/lib/jvm/java-9-openjdk-amd64 in PATH, using it.
Appending to "/etc/default/go-agent": export JAVA_HOME="/usr/lib/jvm/java-9-openjdk-amd64" # SET_BY_GO_INSTALLER__DONT_REMOVE
Installation of Go Agent completed.
Now please edit /etc/default/go-agent and set GO_SERVER to the IP address of your Go Server.
Once that is done start the Go Agent with '/etc/init.d/go-agent start'

I don't remember the exact yum commands to do this on an RPM-based installation but a quick search should come up with that, if you need it.

@steveyang95

This comment has been minimized.

Copy link

commented Aug 4, 2016

@arvindsv Thank you so much!! Greatly appreciate the quick responses and help!

@ketan

This comment has been minimized.

Copy link
Member

commented Aug 5, 2016

I don't remember the exact yum commands to do this on an RPM-based installation but a quick search should come up with that, if you need it.

With yum you'd normally do yum install go-{agent,server}-16.3.0-3183

@zabil

This comment has been minimized.

Copy link
Contributor

commented Aug 11, 2016

Closing this as knows issue.

@zabil zabil closed this Aug 11, 2016

@sudhindra-glooko

This comment has been minimized.

Copy link

commented Oct 17, 2016

@ketan @zabil was this fixed. I upgraded to 16.10 and saw the exact same issue that @barrowkwan experienced. Currently I am unblocked because I renamed agent-launcher and agent.jar files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.