Octopus server failed to start after install

We’re having problems starting Octopus server after a new install, getting the following error below. We’ve tried turning off UAC, changing to a domain account, shutting off the firewall and adding an exception, manually adding a URL reservation and nothing seems to fix it. The install works fine on my local PC so we’re at a loss to what’s not working. Each time we deleted the raven directory to not incur additional problems. This is build: 1.0.15.1246.

2012-07-10 09:35:45,253 [6] ERROR Octopus [(null)] - Autofac.Core.DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:10930
  at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
  at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.GetResponse()
  at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 288
  at Raven.Client.Connection.HttpJsonRequest.ReadResponseString() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 207
  at Raven.Client.Connection.HttpJsonRequest.ExecuteRequest() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:line 151
  at Raven.Client.Connection.ServerClient.DirectPutIndex(String name, String operationUrl, Boolean overwrite, IndexDefinition definition) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 710
  at Raven.Client.Connection.ServerClient.<>c__DisplayClass3b.<PutIndex>b__3a(String operationUrl) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 687
  at Raven.Client.Connection.ServerClient.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 231
  at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 195
  at Raven.Client.Connection.ServerClient.PutIndex(String name, IndexDefinition definition, Boolean overwrite) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:line 687
  at Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands databaseCommands, DocumentConvention documentConvention) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Indexes\AbstractIndexCreationTask.cs:line 121
  at Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDatabaseCommands databaseCommands, DocumentConvention conventions) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Indexes\IndexCreation.cs:line 46
  at Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Indexes\IndexCreation.cs:line 57
  at Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly assemblyToScanForIndexingTasks, IDocumentStore documentStore) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Indexes\IndexCreation.cs:line 34
  at Octopus.Core.Persistance.PersistanceModule.<Load>b__1(IComponentContext c) in c:\BuildAgent\work\7bf5272a44079f5\source\Octopus.Core\Persistance\PersistanceModule.cs:line 41
  at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
  at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
  at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
  at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
  at Autofac.Core.Resolving.InstanceLookup.Execute()
  at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
  at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
  at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
  at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
  at Autofac.Core.Resolving.InstanceLookup.Execute()
  at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
  at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
  --- End of inner exception stack trace ---

Hi Dan,

What happens if you run Octopus.Server.exe interactively?

Octopus Server starts up a RavenDB embedded host instance, and then connects back to it via HTTP. During start up it should print the port number that it is listening on - is that visible in the logs?

I wonder if it might be a timing issue… I’ll investigate and get back to you.

Paul

The debug does indicate that Raven is running at http://localhost:10930 and list the data directory in interactive mode and the log before it crashes. It may be a timing issue or maybe raven is crashing for some reason. Is there a way I can start raven independently to test that?

There’s no way using the Octopus binaries, but you could download and run RavenDB locally (the 960 build) - in the Raven.Server.exe.config file you can configure the port (make it 10930).

Then you can start Octopus.Server.exe with the command line argument -noStorage - this will tell Octopus to use your externally hosted RavenDB instance instead of the embedded instance.

It does look to be a timing issue, I think DocumentStore.Initialize() isn’t blocking like I thought it was.

Paul

Hi Dan,

Can you give this Octopus.Server a try?

It adds a delay between the storage engine starting and connecting to itself.

Paul

Sorry, still failing with the same error as it attempts to read the dashboard controller. I did try copying the working instance on my local machine over and it’s failing as well and my local one should be all initialized. Could you maybe redirect raven logging to your interactive instance so we can see if it’s crashing? I think it is I just don’t know why and can’t find any logs for it that are readable.

As an aside I am trying to install raven but the download is nearly impossible for some reason. 30MB current time is 1h 34m and we have a 50Mb connection…

Hi Dan,

Can you replace your Octopus.Server.exe.config with:

This will direct all RavenDB logs to the console when you start Octopus Server interactively.

Paul

Hey Dan, when you say:

still failing with the same error as it attempts to read the dashboard controller

Does this mean that the server is now starting up, but the website is unable to connect?

Paul

I’ve attached the log file, the only thing I could find was this line:

2012-07-10 11:18:00.1774|ERROR|Raven.Client.Connection.ReplicationInformer|Could not contact master for new replication information

Not sure what that means exactly…

The server itself is still crashing, because the service is stopping and throwing the event above into the log.

Octopus.log (32 KB)

Hi Dan,

It looks like it is starting up ok, and that error you saw is related to not being able to connect on 10930.

Do you have a default proxy server configured on the machine? Is it configured to bypass local addresses? Are any anti virus or other firewalls running?

Paul


From: dan.piessens
Sent: 10/07/2012 17:21
To: Paul Stovell
Subject: Re: Octopus server failed to start after install [Problems]

Hi Dan,

Do you think we’d be able to do some kind of remote session over Skype to figure this out? My skype ID is paulstovell

Paul

Hi Paul,

So I just figured it out… not your fault it’s RavenDB If you machine has multiple IP addresses (our servers do) Raven binds to a specific IP instead of listening on all ports. I ran the service in interactive mode and noticed in the network monitor that it was still listening on only one IP address. I could see the raven studio in interactive mode when I went to the IP, but not when I used “localhost”. You may need to see if the embedded Raven server will give you the IP it’s listening on and connect that way.

The external RavenDB server is subject to the same problem btw, it also explains why it’s working on my machine… only 1 IP :slight_smile:

Wow Dan, you are my hero, nice find!

I’ll see what I can do to work around the issue, thanks again.

In the mean time you could add the appSetting “Persistance.RavenUrl” = http://whichever-ip-works:10930/

Paul


From: dan.piessens
Sent: 10/07/2012 18:59
To: Paul Stovell
Subject: Re: Octopus server failed to start after install [Problems]

Hey Dan,

I just tried reproducing this by adding the Loopback adapter and two IP addresses, but Raven seems to have bound to both ok. Can you send me some more info on how your addresses are configured? And does the machine have two NIC’s or a single NIC with two addresses?

Paul

Sent from my Windows Phone


From: dan.piessens
Sent: 10/07/2012 18:59
To: Paul Stovell
Subject: Re: Octopus server failed to start after install [Problems]

Hi Paul,

It looks like we have a single adapter that has a static IP set then then under “additional settings” has an additional IP address specified. Not sure if this makes a difference but the adapter isn’t “Local Area Connection” but the actual IP address. I’m guessing it’s something to do with the static IP and the additional address.

As an aside the setting helped get the server running but the migration tool and portal can’t connect even with that setting. Is there a trick for those too?

-Dan

The migration tool and web site also have the same appSettings - you can add it to the Tools.exe.config and the web.config of the portal, and they should then start to use that address too.

What happens when you launch a web browser and navigate to http://localhost:10930/ ?

Ohhh… I wonder… Have you configured your http.sys to only bind to one IP address? (Maybe to allow a Tomcat-based service to use one address and IIS the other)?

From an admin command prompt, what does the output of:

netsh http show iplisten

Look like?

RavenDB uses HttpListener which uses Http.sys, so if Http.sys is configured to only use one IP address, then that would explain it.

Paul

Ah, up that would be it. We’ve got TeamCity (Tomcat) running on the server for CI on the other IP so that would most likely be why it’s not working.

So I tried the app setting in the web.config of the portal and the .exe.config of the tool app and it doesn’t seem to be picking those up… getting the usual errors for that.

As a solution would it be possible to just add a registry setting for the address? That would be consistent and in combination with your other switch allow for external raven servers. I would say you don’t even need to add it to the config tool, make it a hidden setting for now.

Ok so I just had a stupid moment… I added 127.0.0.1 to iplisten collection and everything is working fine. I’ll leave any features here up to you, but my problem is fixed.

For anyone else go to an admin command prompt and type:

netsh http add iplisten 127.0.0.1

It shouldn’t affect Tomcat or other apps. Thanks for all the great support Paul!

Hi Dan,

Good suggestion. I included it in this build:

Under HKLM\Software\Octopus, you can add the following string value:

Octopus.Raven.HostName = <your host name>

The screenshot attached gives an example.

Paul