Skip to content

'scalar maintenance' crashes if its repo is deleted out from under it #207

@wilbaker

Description

@wilbaker

TBD if this is specific to the pack-files task.

Steps to reproduce

  1. Create a lot of scalar repos in a common test folder
  2. Modify Scalar.Service to run maintenance tasks more quickly (see diff below)
  3. Delete the scalar repos created in step 1
  4. On Mac (I have not tried Windows yet) you'll see a "Problem Report for scalar" window

Service log

[2019-10-30 15:15:37.9494 -07:00] Error {"Area":"ScalarVerbRunner","ExecutablePath":"/bin/launchctl","arguments":"asuser 502 /usr/local/scalar/scalar maintenance "/Users/wilbaker/scratch/scalarTest/ForTests8" --task pack-files --internal_use_only {"ServiceName":null,"StartedByService":true}","repoRoot":"/Users/wilbaker/scratch/scalarTest/ForTests8","ExitCode":134,"Errors":"","ErrorMessage":"CallMaintenance: Maintenance verb failed"}

Problem Report

Process:               scalar [73962]
Path:                  /usr/local/scalar/scalar
Identifier:            scalar
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        Scalar.Service [72564]
Responsible:           scalar [73962]
User ID:               502

Date/Time:             2019-10-30 15:15:37.959 -0700
OS Version:            Mac OS X 10.14 (18A391)
Report Version:        12
Bridge OS Version:     3.0 (14Y667)
Anonymous UUID:        09701639-5956-27CE-5DB4-6D6B644F4DAA

Sleep/Wake UUID:       76D76A9B-F426-479E-852F-BF34908B650C

Time Awake Since Boot: 170000 seconds
Time Since Wake:       20000 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff59eb7b86 __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff59f6dc50 pthread_kill + 285
2   libsystem_c.dylib             	0x00007fff59e211c9 abort + 127
3   libcoreclr.dylib              	0x0000000105f8c31e PROCAbort + 14
4   libcoreclr.dylib              	0x0000000105f8aea2 PROCEndProcess(void*, unsigned int, int) + 226
5   libcoreclr.dylib              	0x00000001062567f1 UnwindManagedExceptionPass1(PAL_SEHException&, _CONTEXT*) + 737
6   libcoreclr.dylib              	0x0000000106256990 DispatchManagedException(PAL_SEHException&, bool) + 304
7   libcoreclr.dylib              	0x00000001061bb379 IL_Throw(Object*) + 713
8   ???                           	0x000000011519c039 0 + 4648976441
9   ???                           	0x000000011519be5b 0 + 4648975963
10  ???                           	0x000000011519df6b 0 + 4648984427
11  ???                           	0x0000000116afc4d1 0 + 4675585233
12  ???                           	0x0000000116afb272 0 + 4675580530
13  ???                           	0x0000000116a29f53 0 + 4674723667
14  ???                           	0x0000000116a29cfd 0 + 4674723069
15  ???                           	0x0000000116a292e8 0 + 4674720488
16  ???                           	0x0000000116a28fdc 0 + 4674719708
17  ???                           	0x0000000116a28d6b 0 + 4674719083
18  ???                           	0x0000000116a28afa 0 + 4674718458
19  ???                           	0x0000000116a28a2e 0 + 4674718254
20  ???                           	0x0000000116a28979 0 + 4674718073
21  ???                           	0x0000000116a28895 0 + 4674717845
22  ???                           	0x0000000114fe2a14 0 + 4647168532
23  libcoreclr.dylib              	0x00000001062dd8c7 CallDescrWorkerInternal + 124
24  libcoreclr.dylib              	0x000000010614a08d MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 909
25  libcoreclr.dylib              	0x000000010602026a RunMain(MethodDesc*, short, int*, PtrArray**) + 682
26  libcoreclr.dylib              	0x00000001060204df Assembly::ExecuteMainMethod(PtrArray**, int) + 223
27  libcoreclr.dylib              	0x0000000106060174 CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 436
28  libcoreclr.dylib              	0x0000000105f94b46 coreclr_execute_assembly + 230
29  libhostpolicy.dylib           	0x0000000105edf3d8 0x105e56000 + 562136
30  libhostpolicy.dylib           	0x0000000105ec8813 0x105e56000 + 469011
31  libhostpolicy.dylib           	0x0000000105ecf099 0x105e56000 + 495769
32  libhostfxr.dylib              	0x0000000105df18a3 0x105d67000 + 567459
33  libhostfxr.dylib              	0x0000000105e115ee 0x105d67000 + 697838
34  libhostfxr.dylib              	0x0000000105e141c2 0x105d67000 + 709058
35  libhostfxr.dylib              	0x0000000105e12678 0x105d67000 + 702072
36  libhostfxr.dylib              	0x0000000105df2919 0x105d67000 + 571673
37  scalar                        	0x0000000105d36dd4 0x105d29000 + 56788
38  scalar                        	0x0000000105d373a5 0x105d29000 + 58277
39  libdyld.dylib                 	0x00007fff59d79085 start + 1

Maintenance code diff

diff --git a/Scalar.Service/MaintenanceTaskScheduler.cs b/Scalar.Service/MaintenanceTaskScheduler.cs
index eeb8b93b..f1a9132d 100644
--- a/Scalar.Service/MaintenanceTaskScheduler.cs
+++ b/Scalar.Service/MaintenanceTaskScheduler.cs
@@ -9,16 +9,16 @@ namespace Scalar.Service
 {
     public class MaintenanceTaskScheduler : IDisposable, IRegisteredUserStore
     {
-        private readonly TimeSpan looseObjectsDueTime = TimeSpan.FromMinutes(5);
-        private readonly TimeSpan looseObjectsPeriod = TimeSpan.FromHours(6);
+        private readonly TimeSpan looseObjectsDueTime = TimeSpan.FromSeconds(30);
+        private readonly TimeSpan looseObjectsPeriod = TimeSpan.FromSeconds(45);
 
-        private readonly TimeSpan packfileDueTime = TimeSpan.FromMinutes(30);
-        private readonly TimeSpan packfilePeriod = TimeSpan.FromHours(12);
+        private readonly TimeSpan packfileDueTime = TimeSpan.FromSeconds(15);
+        private readonly TimeSpan packfilePeriod = TimeSpan.FromSeconds(60);
 
-        private readonly TimeSpan commitGraphDueTime = TimeSpan.FromMinutes(15);
-        private readonly TimeSpan commitGraphPeriod = TimeSpan.FromHours(1);
+        private readonly TimeSpan commitGraphDueTime = TimeSpan.FromSeconds(10);
+        private readonly TimeSpan commitGraphPeriod = TimeSpan.FromSeconds(60);
 
-        private readonly TimeSpan fetchCommitsAndTreesPeriod = TimeSpan.FromMinutes(15);
+        private readonly TimeSpan fetchCommitsAndTreesPeriod = TimeSpan.FromSeconds(30);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcorrectness issuesno-activityStale issue or PR that will be automatically closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions