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

Analyze RavenDB child process #4786

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ServiceControl.Audit/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ These settings are only here so that we can debug ServiceControl while developin
<add key="ServiceControl.Audit/ServiceControlQueueAddress" value="Particular.ServiceControl" />
<add key="ServiceControl.Audit/HostName" value="localhost" />
<add key="ServiceControl.Audit/DatabaseMaintenancePort" value="44445" />
<add key="ServiceControl.Audit/LogPath" value="/tmp/sc_audit/logs" />
<add key="ServiceControl.Audit/DBPath" value="/tmp/sc_audit/db" />

<!-- DEVS - Pick a transport to run Auditing instance on -->
<add key="ServiceControl.Audit/TransportType" value="LearningTransport" />
Expand All @@ -20,8 +22,8 @@ These settings are only here so that we can debug ServiceControl while developin
<!--<add key="ServiceControl.Audit/TransportType" value="SQLServer" />-->

<!-- DEVS - Pick a persistence to run Auditing instance on. -->
<add key="ServiceControl.Audit/PersistenceType" value="InMemory" />
<!--<add key="ServiceControl.Audit/PersistenceType" value="RavenDB" />-->
<!-- <add key="ServiceControl.Audit/PersistenceType" value="InMemory" /> -->
<add key="ServiceControl.Audit/PersistenceType" value="RavenDB" />
</appSettings>
<connectionStrings>
<!-- DEVS - Pick a transport connection string to match chosen transport above -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static void AddServiceControlAudit(this IHostApplicationBuilder builder,
var transportCustomization = TransportFactory.Create(transportSettings);
transportCustomization.AddTransportForAudit(services, transportSettings);

services.Configure<HostOptions>(options => options.ShutdownTimeout = TimeSpan.FromSeconds(30));
services.Configure<HostOptions>(options => options.ShutdownTimeout = settings.ShutdownTimeout);

services.AddSingleton(settings);
services.AddSingleton<EndpointInstanceMonitoring>();
Expand Down
4 changes: 4 additions & 0 deletions src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public Settings(string transportType = null, string persisterType = null, Loggin
EnableFullTextSearchOnBodies = SettingsReader.Read(SettingsRootNamespace, "EnableFullTextSearchOnBodies", true);

AssemblyLoadContextResolver = static assemblyPath => new PluginAssemblyLoadContext(assemblyPath);
ShutdownTimeout = SettingsReader.Read(SettingsRootNamespace, "ShutdownTimeout", ShutdownTimeout);
Environment.SetEnvironmentVariable("ShutdownTimeout", ShutdownTimeout.ToString());
}

void LoadAuditQueueInformation()
Expand Down Expand Up @@ -151,6 +153,8 @@ public int MaxBodySizeToStore

public bool EnableFullTextSearchOnBodies { get; set; }

public TimeSpan ShutdownTimeout { get; set; } = TimeSpan.FromMinutes(5);

public TransportSettings ToTransportSettings()
{
var transportSettings = new TransportSettings
Expand Down
16 changes: 16 additions & 0 deletions src/ServiceControl.RavenDB/EmbeddedDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Raven.Client.Documents.Conventions;
using Raven.Client.ServerWide.Operations;
using Raven.Embedded;
using Sparrow.Logging;

public sealed class EmbeddedDatabase : IDisposable
{
Expand Down Expand Up @@ -52,9 +53,24 @@

var nugetPackagesPath = Path.Combine(databaseConfiguration.DbPath, "Packages", "NuGet");

LoggingSource.Instance.SetupLogMode(
(LogMode)255,
Path.Combine(databaseConfiguration.LogPath, "client"),
TimeSpan.FromDays(7),
1024 * 1024 * 10,
false
);

LoggingSource.Instance.EnableConsoleLogging();

var gracefulShutdownTimeout = TimeSpan.Parse(Environment.GetEnvironmentVariable("ShutdownTimeout"));

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-SQS

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-SQS

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-PrimaryRavenAcceptance

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-PrimaryRavenAcceptance

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-AzureServiceBus

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-AzureServiceBus

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-SqlServer

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-SqlServer

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-RabbitMQ

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-RabbitMQ

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-Default

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-Default

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-AzureStorageQueues

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-AzureStorageQueues

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-PrimaryRavenPersistence

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-PrimaryRavenPersistence

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-PostgreSQL

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Linux-PostgreSQL

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-SQS

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-SQS

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-AzureStorageQueues

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-AzureStorageQueues

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-PostgreSQL

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-PostgreSQL

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-PrimaryRavenPersistence

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-PrimaryRavenPersistence

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-MSMQ

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-MSMQ

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-RabbitMQ

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-RabbitMQ

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-SqlServer

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-SqlServer

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / windows-installers / build

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / windows-installers / build

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-PrimaryRavenAcceptance

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-PrimaryRavenAcceptance

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-AzureServiceBus

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-AzureServiceBus

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-Default

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.

Check failure on line 66 in src/ServiceControl.RavenDB/EmbeddedDatabase.cs

View workflow job for this annotation

GitHub Actions / Windows-Default

Possible null reference argument for parameter 's' in 'TimeSpan TimeSpan.Parse(string s)'.
// Must be less to ensure teardown of child process completes
gracefulShutdownTimeout -= TimeSpan.FromSeconds(5);

Logger.InfoFormat("Loading RavenDB license from {0}", licenseFileNameAndServerDirectory.LicenseFileName);
var serverOptions = new ServerOptions
{
GracefulShutdownTimeout = gracefulShutdownTimeout,
CommandLineArgs =
[
$"--Logs.Mode={databaseConfiguration.LogsMode}",
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceControl/HostApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void AddServiceControl(this IHostApplicationBuilder hostBuilder, S
var transportCustomization = TransportFactory.Create(transportSettings);
transportCustomization.AddTransportForPrimary(services, transportSettings);

services.Configure<HostOptions>(options => options.ShutdownTimeout = TimeSpan.FromSeconds(30));
services.Configure<HostOptions>(options => options.ShutdownTimeout = settings.ShutdownTimeout);
services.AddSingleton<IDomainEvents, DomainEvents>();

services.AddSingleton<MessageStreamerHub>();
Expand Down
4 changes: 4 additions & 0 deletions src/ServiceControl/Infrastructure/Settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public Settings(
DisableExternalIntegrationsPublishing = SettingsReader.Read(SettingsRootNamespace, "DisableExternalIntegrationsPublishing", false);
TrackInstancesInitialValue = SettingsReader.Read(SettingsRootNamespace, "TrackInstancesInitialValue", true);
AssemblyLoadContextResolver = static assemblyPath => new PluginAssemblyLoadContext(assemblyPath);
ShutdownTimeout = SettingsReader.Read(SettingsRootNamespace, "ShutdownTimeout", ShutdownTimeout);
Environment.SetEnvironmentVariable("ShutdownTimeout", ShutdownTimeout.ToString());
}

[JsonIgnore]
Expand Down Expand Up @@ -180,6 +182,8 @@ public TimeSpan HeartbeatGracePeriod

public bool DisableHealthChecks { get; set; }

public TimeSpan ShutdownTimeout { get; set; } = TimeSpan.FromMinutes(5);

public string GetConnectionString()
{
var settingsValue = SettingsReader.Read<string>(SettingsRootNamespace, "ConnectionString");
Expand Down
Loading