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

Cannot Disable Raven (3.3.4) #923

Closed
DrivenLogic opened this issue Jan 29, 2013 · 10 comments
Closed

Cannot Disable Raven (3.3.4) #923

DrivenLogic opened this issue Jan 29, 2013 · 10 comments

Comments

@DrivenLogic
Copy link

  1. During the Msi Install I cleared the raven install option
  2. When starting my host I call
    .DisableRavenInstall()

Raven is still activated during start-up and is making two networking calls that are conflicting with other processes listening on 8080.

GET /databases/[asm.name]/docs/Raven/Replication/Destinations 403 Access denied 78ms 
Content-Type
application/json; charset=utf-8
Host
localhost:8080
Connection
Keep-Alive
GET /docs/Raven/Databases/[asm.name] 403 Access denied 63ms 
Content-Type
application/json; charset=utf-8
localhost:8080
Connection
Keep-Alive

Which on the NSB side looks like this:

System.Net.WebException occurred
  Message=The remote server returned an error: (404) Not Found.
   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 287

How do I disable Raven? Or at least stop it making network requests?

This may be the fix #797
But its flaged for NSB v4 ? this is no doubt a bug and needs fixing in 3.x

Regards,
Andrew Stone.

@johnsimons
Copy link
Member

Yes this is related to #797.
There is a workaround, you need to create your own profile!
I assume you are using the Production Profile right?

@johnsimons
Copy link
Member

The workaround:

    public class MyProduction : PerformanceCounters
    {
    }

    public class MyProductionProfileHandler : IHandleProfile<MyProduction>
    {
        void IHandleProfile.ProfileActivated()
        {
            if (!Configure.Instance.Configurer.HasComponent<IManageMessageFailures>())
                Configure.Instance.MessageForwardingInCaseOfFault();
        }
    }

Add the above code to your endpoint, this should stop Raven from being called.
Let me know if this works?

@DrivenLogic
Copy link
Author

Yes I am using the production profile.

It’s a bit disappointing you are not patching 3.x there are some pretty ugly and broad assumptions here in regards to Raven:

internal class ProductionProfileHandler : IHandleProfile<Production>, IWantTheEndpointConfig
    {
        void IHandleProfile.ProfileActivated()
        {
            Configure.Instance.RavenPersistence();

            if (!Configure.Instance.Configurer.HasComponent<ISagaPersister>())
                Configure.Instance.RavenSagaPersister();

            if (!Configure.Instance.Configurer.HasComponent<IManageMessageFailures>())
                Configure.Instance.MessageForwardingInCaseOfFault();

            if (Config is AsA_Publisher && !Configure.Instance.Configurer.HasComponent<ISubscriptionStorage>())
                Configure.Instance.RavenSubscriptionStorage();
        }

        public IConfigureThisEndpoint Config { get; set; }
    }

I will put the work around in. thanks .

Regards,
Andrew.

@DrivenLogic
Copy link
Author

I can confirm the workaround fixes the Raven Calls on 8080.

It does not however stop the Raven Licencing code from being called? Is there a workaround for that?

Rhino.Licensing.AbstractLicenseValidator contains a hardcoded list of time servers, some of which don’t resolve in my environment which causes a cascade of network exceptions and timeouts.

How do I prevent Rhino.Licensing.LicenseValidator from being loaded?

@johnsimons
Copy link
Member

That is good to hear.

Regarding Rhino.Licensing.AbstractLicenseValidator there is no workaround for that one.
Can you please raise another issue for that.

@DrivenLogic
Copy link
Author

Ok thanks.

@DrivenLogic
Copy link
Author

On second glance it actually it looks like its NSBs use of Rhino.Licensing.AbstractLicenseValidator the causing the exceptions?

https://github.com/NServiceBus/NServiceBus/blob/master/src/impl/licensing/NServiceBus.Licensing/LicenseValidator.cs#L38

So I guess that calling external time servers is an intended side effect of using Rhino.Licensing? and therefore what I am seeing is by design?

protected AbstractLicenseValidator(string publicKey)
{
    this.Log = LogManager.GetLogger(typeof(LicenseValidator));
    this.TimeServers = new string[] { "time.nist.gov", "time-nw.nist.gov", "time-a.nist.gov", "time-b.nist.gov", "time-a.timefreq.bldrdoc.gov", "time-b.timefreq.bldrdoc.gov", "time-c.timefreq.bldrdoc.gov", "utcnist.colorado.edu", "nist1.datum.com", "nist1.dc.certifiedtime.com", "nist1.nyc.certifiedtime.com", "nist1.sjc.certifiedtime.com" };
    this.LicenseAttributes = new Dictionary<string, string>();
    this.nextLeaseTimer = new Timer(new TimerCallback(this.LeaseLicenseAgain));
    this.publicKey = publicKey;
}

private void ValidateUsingNetworkTime()
{
    if (NetworkInterface.GetIsNetworkAvailable())
    {
        new SntpClient(this.TimeServers).BeginGetDate(delegate (DateTime time) {
            if (time > this.ExpirationDate)
            {
                this.RaiseLicenseInvalidated();
            }
        }, delegate {
        });
    }
}

public void BeginGetDate(Action<DateTime> getTime, Action failure)
{
    this.index++;
    if (this.hosts.Length <= this.index)
    {
        failure();
    }
    else
    {
        try
        {
            string hostNameOrAddress = this.hosts[this.index];
            State state = new State(null, null, getTime, failure);
            IAsyncResult result = Dns.BeginGetHostAddresses(hostNameOrAddress, new AsyncCallback(this.EndGetHostAddress), state);
            this.RegisterWaitForTimeout(state, result);
        }
        catch (Exception)
        {
            this.BeginGetDate(getTime, failure);
        }
    }
}

@DrivenLogic
Copy link
Author

Issue raised upstream ayende/rhino-licensing#5

@andreasohlund
Copy link
Member

Since its been fixed we should update NSB with the lastest Rhino.Licensing.

#929

Thanks for bringing this up!

On Tue, Jan 29, 2013 at 8:44 AM, drivenlogic.com.au <
[email protected]> wrote:

Issue raised upstream ayende/rhino-licensing#5ayende/rhino-licensing#5


Reply to this email directly or view it on GitHubhttps://github.com//issues/923#issuecomment-12823800.

http://andreasohlund.net
http://twitter.com/andreasohlund

@DrivenLogic
Copy link
Author

No Problem! 👍

Regards,
Andrew Stone.

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

2 participants