@@ -512,87 +512,10 @@ function makeArgsArangod (options, appDir, role, tmpDir) {
512
512
return args ;
513
513
}
514
514
515
-
516
- // //////////////////////////////////////////////////////////////////////////////
517
- // / @brief check whether process does bad on the wintendo
518
- // //////////////////////////////////////////////////////////////////////////////
519
-
520
- function runProcdump ( options , instanceInfo , rootDir , pid , instantDump = false ) {
521
- let procdumpArgs = [ ] ;
522
- let dumpFile = fs . join ( rootDir , 'core_' + pid + '.dmp' ) ;
523
- if ( options . exceptionFilter != null ) {
524
- procdumpArgs = [
525
- '-accepteula' ,
526
- '-64' ,
527
- ] ;
528
- if ( ! instantDump ) {
529
- procdumpArgs . push ( '-e' ) ;
530
- procdumpArgs . push ( options . exceptionCount ) ;
531
- }
532
- let filters = options . exceptionFilter . split ( ',' ) ;
533
- for ( let which in filters ) {
534
- procdumpArgs . push ( '-f' ) ;
535
- procdumpArgs . push ( filters [ which ] ) ;
536
- }
537
- procdumpArgs . push ( '-ma' ) ;
538
- procdumpArgs . push ( pid ) ;
539
- procdumpArgs . push ( dumpFile ) ;
540
- } else {
541
- procdumpArgs = [
542
- '-accepteula' ,
543
- ] ;
544
- if ( ! instantDump ) {
545
- procdumpArgs . push ( '-e' ) ;
546
- }
547
- procdumpArgs . push ( '-ma' ) ;
548
- procdumpArgs . push ( pid ) ;
549
- procdumpArgs . push ( dumpFile ) ;
550
- }
551
- try {
552
- if ( options . extremeVerbosity ) {
553
- print ( Date ( ) + " Starting procdump: " + JSON . stringify ( procdumpArgs ) ) ;
554
- }
555
- instanceInfo . coreFilePattern = dumpFile ;
556
- if ( instantDump ) {
557
- // Wait for procdump to have written the dump before we attempt to kill the process:
558
- instanceInfo . monitor = executeExternalAndWait ( 'procdump' , procdumpArgs ) ;
559
- } else {
560
- instanceInfo . monitor = executeExternal ( 'procdump' , procdumpArgs ) ;
561
- // try to give procdump a little time to catch up with the process
562
- sleep ( 0.25 ) ;
563
- let status = statusExternal ( instanceInfo . monitor . pid , false ) ;
564
- if ( status . hasOwnProperty ( 'signal' ) ) {
565
- print ( RED + 'procdump didn\'t come up: ' + JSON . stringify ( status ) ) ;
566
- instanceInfo . monitor . status = status ;
567
- return false ;
568
- }
569
- }
570
- } catch ( x ) {
571
- print ( Date ( ) + ' failed to start procdump - is it installed?' ) ;
572
- // throw x;
573
- return false ;
574
- }
575
- return true ;
576
- }
577
-
578
- function stopProcdump ( options , instanceInfo , force = false ) {
579
- if ( instanceInfo . hasOwnProperty ( 'monitor' ) &&
580
- instanceInfo . monitor . pid !== null ) {
581
- if ( force ) {
582
- print ( Date ( ) + " sending TERM to procdump to make it exit" ) ;
583
- instanceInfo . monitor . status = killExternal ( instanceInfo . monitor . pid , termSignal ) ;
584
- } else {
585
- print ( Date ( ) + " waiting for procdump to exit" ) ;
586
- statusExternal ( instanceInfo . monitor . pid , true ) ;
587
- }
588
- instanceInfo . monitor . pid = null ;
589
- }
590
- }
591
-
592
515
function killWithCoreDump ( options , instanceInfo ) {
593
516
if ( platform . substr ( 0 , 3 ) === 'win' && ! options . disableMonitor ) {
594
- stopProcdump ( options , instanceInfo , true ) ;
595
- runProcdump ( options , instanceInfo , instanceInfo . rootDir , instanceInfo . pid , true ) ;
517
+ crashUtils . stopProcdump ( options , instanceInfo , true ) ;
518
+ crashUtils . runProcdump ( options , instanceInfo , instanceInfo . rootDir , instanceInfo . pid , true ) ;
596
519
}
597
520
instanceInfo . exitStatus = killExternal ( instanceInfo . pid , abortSignal ) ;
598
521
}
@@ -733,14 +656,14 @@ function executeAndWait (cmd, args, options, valgrindTest, rootDir, coreCheck =
733
656
res = executeExternal ( cmd , args , false , coverageEnvironment ( ) ) ;
734
657
instanceInfo . pid = res . pid ;
735
658
instanceInfo . exitStatus = res ;
736
- if ( runProcdump ( options , instanceInfo , rootDir , res . pid ) ) {
659
+ if ( crashUtils . runProcdump ( options , instanceInfo , rootDir , res . pid ) ) {
737
660
Object . assign ( instanceInfo . exitStatus ,
738
661
statusExternal ( res . pid , true , timeout * 1000 ) ) ;
739
662
if ( instanceInfo . exitStatus . status === 'TIMEOUT' ) {
740
663
print ( 'Timeout while running ' + cmd + ' - will kill it now! ' + JSON . stringify ( args ) ) ;
741
664
executeExternalAndWait ( 'netstat' , [ '-aonb' ] ) ;
742
665
killExternal ( res . pid ) ;
743
- stopProcdump ( options , instanceInfo ) ;
666
+ crashUtils . stopProcdump ( options , instanceInfo ) ;
744
667
instanceInfo . exitStatus . status = 'ABORTED' ;
745
668
const deltaTime = time ( ) - startTime ;
746
669
return {
@@ -750,7 +673,7 @@ function executeAndWait (cmd, args, options, valgrindTest, rootDir, coreCheck =
750
673
duration : deltaTime
751
674
} ;
752
675
}
753
- stopProcdump ( options , instanceInfo ) ;
676
+ crashUtils . stopProcdump ( options , instanceInfo ) ;
754
677
} else {
755
678
print ( 'Killing ' + cmd + ' - ' + JSON . stringify ( args ) ) ;
756
679
res = killExternal ( res . pid ) ;
@@ -762,6 +685,7 @@ function executeAndWait (cmd, args, options, valgrindTest, rootDir, coreCheck =
762
685
res = executeExternalAndWait ( cmd , args , false , timeout * 100 , coverageEnvironment ( ) ) ;
763
686
instanceInfo . pid = res . pid ;
764
687
instanceInfo . exitStatus = res ;
688
+ crashUtils . calculateMonitorValues ( options , instanceInfo , res . pid , cmd ) ;
765
689
}
766
690
const deltaTime = time ( ) - startTime ;
767
691
@@ -1486,13 +1410,13 @@ function shutdownInstance (instanceInfo, options, forceTerminate) {
1486
1410
serverCrashedLocal = true ;
1487
1411
shutdownSuccess = false ;
1488
1412
}
1489
- stopProcdump ( options , arangod ) ;
1413
+ crashUtils . stopProcdump ( options , arangod ) ;
1490
1414
} else {
1491
1415
if ( arangod . role !== 'agent' ) {
1492
1416
nonAgenciesCount -- ;
1493
1417
}
1494
1418
print ( Date ( ) + ' Server "' + arangod . role + '" shutdown: Success: pid' , arangod . pid ) ;
1495
- stopProcdump ( options , arangod ) ;
1419
+ crashUtils . stopProcdump ( options , arangod ) ;
1496
1420
return false ;
1497
1421
}
1498
1422
} ) ;
@@ -1918,8 +1842,8 @@ function startArango (protocol, options, addArgs, rootDir, role) {
1918
1842
instanceInfo . role = role ;
1919
1843
instanceInfo [ 'name' ] = role + ' - ' + port ;
1920
1844
1921
- if ( platform . substr ( 0 , 3 ) === 'win' && ! options . disableMonitor ) {
1922
- if ( ! runProcdump ( options , instanceInfo , rootDir , instanceInfo . pid ) ) {
1845
+ if ( crashUtils . isEnabledWindowsMonitor ( options , instanceInfo , instanceInfo . pid , ARANGOD_BIN ) ) {
1846
+ if ( ! crashUtils . runProcdump ( options , instanceInfo , rootDir , instanceInfo . pid ) ) {
1923
1847
print ( 'Killing ' + ARANGOD_BIN + ' - ' + JSON . stringify ( args ) ) ;
1924
1848
let res = killExternal ( instanceInfo . pid ) ;
1925
1849
instanceInfo . pid = res . pid ;
@@ -2062,8 +1986,8 @@ function reStartInstance(options, instanceInfo, moreArgs) {
2062
1986
2063
1987
throw x ;
2064
1988
}
2065
- if ( platform . substr ( 0 , 3 ) === 'win' && ! options . disableMonitor ) {
2066
- if ( ! runProcdump ( options , oneInstanceInfo , oneInstanceInfo . rootDir , oneInstanceInfo . pid ) ) {
1989
+ if ( crashUtils . isEnabledWindowsMonitor ( options , oneInstanceInfo , oneInstanceInfo . pid , ARANGOD_BIN ) ) {
1990
+ if ( ! crashUtils . runProcdump ( options , oneInstanceInfo , oneInstanceInfo . rootDir , oneInstanceInfo . pid ) ) {
2067
1991
print ( 'Killing ' + ARANGOD_BIN + ' - ' + JSON . stringify ( oneInstanceInfo . args ) ) ;
2068
1992
let res = killExternal ( oneInstanceInfo . pid ) ;
2069
1993
oneInstanceInfo . pid = res . pid ;
@@ -2156,7 +2080,6 @@ exports.coverageEnvironment = coverageEnvironment;
2156
2080
exports . executeArangod = executeArangod ;
2157
2081
exports . executeAndWait = executeAndWait ;
2158
2082
exports . killRemainingProcesses = killRemainingProcesses ;
2159
- exports . stopProcdump = stopProcdump ;
2160
2083
2161
2084
exports . createBaseConfig = createBaseConfigBuilder ;
2162
2085
exports . run = {
0 commit comments