Question

I have an NServiceBus saga that is trying to schedule a timeout using the Raven timeout persister but when it tries it gets this error:

NServiceBus.Unicast.Transport.Transactional.TransactionalTransport [(null)] <(null)> - Failed raising 'transport message received' event for message with ID=90dadfbd-9eb6-4558-96ec-37edb642330a\17275422
    System.InvalidOperationException: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
    <HTML><HEAD><TITLE>Bad Request</TITLE>
    <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
    <BODY><h2>Bad Request - Request Too Long</h2>
    <hr><p>HTTP Error 400. The size of the request headers is too long.</p>
    </BODY></HTML>
     ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
       at System.Net.HttpWebRequest.GetResponse()
       at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse)
       --- End of inner exception stack trace ---
       at Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1 getResponse)
       at Raven.Client.Connection.HttpJsonRequest.ReadResponseString()
       at Raven.Client.Connection.HttpJsonRequest.ReadResponseJson()
       at Raven.Client.Connection.ServerClient.DirectPut(RavenJObject metadata, String key, Nullable`1 etag, RavenJObject document, String operationUrl)
       at Raven.Client.Connection.ServerClient.<>c__DisplayClass10.<Put>b__f(String u)
       at Raven.Client.Connection.ServerClient.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result)
       at Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation)
       at Raven.Client.Connection.ServerClient.Put(String key, Nullable`1 etag, RavenJObject document, RavenJObject metadata)
       at Raven.Client.Document.HiLoKeyGenerator.PutDocument(JsonDocument document)
       at Raven.Client.Document.HiLoKeyGenerator.GetNextMax()
       at Raven.Client.Document.HiLoKeyGenerator.NextId()
       at Raven.Client.Document.HiLoKeyGenerator.GenerateDocumentKey(DocumentConvention convention, Object entity)
       at Raven.Client.Document.MultiTypeHiLoKeyGenerator.GenerateDocumentKey(DocumentConvention conventions, Object entity)
       at Raven.Client.Document.DocumentStore.<>c__DisplayClass1.<Initialize>b__0(Object entity)
       at Raven.Client.Document.InMemoryDocumentSessionOperations.GetOrGenerateDocumentKey(Object entity)
       at Raven.Client.Document.InMemoryDocumentSessionOperations.StoreInternal(Object entity, Nullable`1 etag, String id)
       at Raven.Client.Document.InMemoryDocumentSessionOperations.Store(Object entity)
       at NServiceBus.Timeout.Hosting.Windows.Persistence.RavenTimeoutPersistence.Add(TimeoutData timeout)
       at NServiceBus.Timeout.Core.TimeoutTransportMessageHandler.Handle(TransportMessage message)
       at NServiceBus.Unicast.Transport.Transactional.TransactionalTransport.OnTransportMessageReceived(TransportMessage msg)

I have restarted the Raven service & the nservicebus host. I've tried recreating this saga again but it still happens.

The timeout status message that is being scheduled is tiny:

<Messages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/Invoicing.Service">
    <IPartPaymentTimeout>
        <Amount>10.00</Amount>
        <OriginalTransactionTimeUtc>2013-01-14T05:49:04.8180938Z</OriginalTransactionTimeUtc>
        <PaymentNumber>7</PaymentNumber>
        <Id>123456</Id>
        <InvoiceNumber>1234567/34567</InvoiceNumber>
    </IPartPaymentTimeout>
</Messages>
Was it helpful?

Solution

This was resolved in my case by stopping New Relic from instumenting custom applications. It looks like there is a bug in New Relic where it appends a request header X-NewRelic-ID, which gets appended with the same data until it grows too long:

X-NewRelic-ID: <hash>, <samehash>, <samehash>,.....<samehash>

Disabling instrumentation of NServiceBus.Host in the NewRelic.xml file prevents the header being sent.

In NewRelic.xml, you might also disable crossApplicationTracingEnabled.

To detect this, use tracing from System.Diagnostics:

  <system.diagnostics>
<trace autoflush="true" />
<sources>
  <source name="System.Net" maxdatasize="1024">
    <listeners>
      <add name="MyTraceFile"/>
    </listeners>
  </source>
</sources>

<sharedListeners>
  <add
    name="MyTraceFile"
    type="System.Diagnostics.TextWriterTraceListener"
    initializeData="System.Net.trace.log"
            />
</sharedListeners>

<switches>
  <add name="System.Net" value="Verbose" />
</switches>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top