18179

NServiceBus 4.4.2 how do i set the TimeoutPersisterReceiver timespan in config

Question:

How do I increase the timespan of the TimeoutPersisterReceiver? it currently retries for ~1min after arming before firing. I have looked in the documentation but cannot see a config setting for it.

We have been having some network issues that prevented a service from talking to the database causing the RepeatedFailuresOverTimeCircuitBreaker to arm itself.

INFO NServiceBus.CircuitBreakers.RepeatedFailuresOverTimeCircuitBreaker [(null)] - The circuit breaker for TimeoutStorageConnectivity is now in the armed state

The database will eventually come back online but by the time it does the circuit breaker has been fired and the Bus has been disposed. I need to increase the time span of the NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver.

NServiceBus.CircuitBreakers.RepeatedFailuresOverTimeCircuitBreaker [(null)] - The circuit breaker for TimeoutStorageConnectivity will now be triggered FATAL NServiceBus [(null)] - Repeated failures when fetching timeouts from storage, endpoint will be terminated.

Answer1:

You can try to configure it in a class that implements IWantToRunWhenBusStartsAndStops and use the SecondsToSleepBetweenPolls property of the TimeoutPersisterReceiver.

However, I would add that public access to this configuration option was removed in later versions, and I'm not 100% sure why. There may be dragons. See <a href="http://bit.ly/1ToyOHb" rel="nofollow">http://bit.ly/1ToyOHb</a> (GitHub).

Answer2:

Circuit breaker behavior

After researching the code it seems that you would be able to configure the timeout poll interval via TimeoutPersisterReceiver.SecondsToSleepBetweenPolls but that does not really matter.

The embedded circuit breaker configuration cannot be adjusted. If an error occurs it is <em>armed</em> and if no successful poll succeeds within 2 minutes the circuit breaker action will be triggered which is calling raising a critical error.

Increasing the poll interval will not help here. If you would make the poll interval more than 2 minutes the circuit breaker will <em>always</em> be armed thus trigger the action.

<ul><li>

<a href="https://github.com/Particular/NServiceBus/blob/4.7.12/src/NServiceBus.Core/Timeout/Hosting/Windows/TimeoutPersisterReceiver.cs#L150" rel="nofollow">https://github.com/Particular/NServiceBus/blob/4.7.12/src/NServiceBus.Core/Timeout/Hosting/Windows/TimeoutPersisterReceiver.cs#L150</a>

</li> <li>

<a href="https://github.com/Particular/NServiceBus/blob/4.7.12/src/NServiceBus.Core/CircuitBreakers/RepeatedFailuresOverTimeCircuitBreaker.cs" rel="nofollow">https://github.com/Particular/NServiceBus/blob/4.7.12/src/NServiceBus.Core/CircuitBreakers/RepeatedFailuresOverTimeCircuitBreaker.cs</a>

</li> </ul>

There is nothing that you can do unfortunately except building your own version that removes the circuit breaker completely.

This behavior can result in issues when your database server does a fail-over.

Critical error handling

The only possible solution to tackle this condition is by hooking into the critical error handler. Then you know such issue occurs and can do a application shutdown as I suspect that you are currently self-hosting.

You can also try to create a whole new bus instance and 'swap' the broken one with the fresh one but that is a pretty daunting task and I would recommend to <em>just exit your application</em>.

Recommend

  • My 'Explicit Wait' doesn't work but 'Implicit Wait' Works?
  • Selenium WebDriver setting ImplicitlyWait does nothing
  • asp.net login page issue
  • How do I prevent ASP.NET from logging authentication failures?
  • Golang: “compress/flate” module can't decompress valid deflate compressed HTTP body
  • BPEL Designer for Eclipse: how to debug a BPEL process
  • ndk-build error.opencv2/core/core.hpp: No such file or directory
  • Netezza aggregation issue (pivot)
  • Is there a way to stop/re-start ejb 3.1 automatic timer during runtime?
  • wchar_t is 2-bytes in visual studio and stores UTF-16. How do Unicode-aware applications work with c
  • Web Application and In-Memory State
  • Using replacements with a raw Sequelize query: avoiding single quotes?
  • Trying to Get SQS Message ID with Boto
  • Unable to add the file iOS application bundle
  • Determine if UTF-8 encoded NSData contains a null-terminated string
  • SMT prover yields 'unknown' despite strong proven assertions
  • @RunWith causes Maven to ignore my Test running with my own runner
  • What to do if “git push heroku master” failed?
  • Data Type of Columns in a List - R
  • Why are `colMeans()` and `rowMeans()` functions faster than using the mean function with `lapply()`?
  • Windows batch string manipulation in loop
  • How to get or calculate size of Azure File/Share or Service
  • How read between delimiters in php DOM of a XML file?
  • Where to save the local DB created for iphone app?
  • Sum values in array of hash if they have the same value
  • Nginx rewrite equivalent to Apache RewriteRule that converts URL params into QueryString key/value p
  • get passwords from chrome
  • Heroku push rejected - Hartl's Rails 3.2 tutorial
  • Does the Azure table storage API cache results?
  • why my app based on boost::asio didn't accept new connection
  • How to repeat sections of a SQL query across UNIONs? (DRY in SQL)
  • Unable to connect to OnVif enabled camera using C#
  • Setting WPF Window Background to Resource Dictionary Brush User Setting
  • Configure Spring's MappingJacksonHttpMessageConverter
  • XSLT foreach repeating nodes to flat
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • How do I configure context broker accept post requests from my remote sensor?
  • swift auto completion not working in Xcode6-Beta
  • How to get NHibernate ISession to cache entity not retrieved by primary key