@@ -1111,7 +1111,8 @@ async Task StopJobAsync()
11111111 {
11121112 try
11131113 {
1114- if ( process != null && ! eventPipeTerminated && ! ! process . HasExited )
1114+ Log . WriteLine ( $ "Stopping counter event pipes for job { job . Id } ") ;
1115+ if ( process != null && ! eventPipeTerminated && ! process . HasExited )
11151116 {
11161117 EventPipeClient . StopTracing ( process . Id , eventPipeSessionId ) ;
11171118 }
@@ -1127,7 +1128,8 @@ async Task StopJobAsync()
11271128 {
11281129 try
11291130 {
1130- if ( process != null && ! measurementsTerminated && ! ! process . HasExited )
1131+ Log . WriteLine ( $ "Stopping measurement event pipes for job { job . Id } ") ;
1132+ if ( process != null && ! eventPipeTerminated && ! process . HasExited )
11311133 {
11321134 EventPipeClient . StopTracing ( process . Id , measurementsSessionId ) ;
11331135 }
@@ -3582,7 +3584,7 @@ private static void StartCounters(ServerJob job)
35823584 format : EventPipeSerializationFormat . NetTrace ,
35833585 providers : providerList ) ;
35843586
3585- EventPipeEventSource source = null ;
3587+ EventPipeEventSource source = null ;
35863588 Stream binaryReader = null ;
35873589
35883590 var retries = 10 ;
@@ -3659,7 +3661,15 @@ private static void StartCounters(ServerJob job)
36593661 }
36603662 catch ( Exception ex )
36613663 {
3662- Log . WriteLine ( $ "[ERROR] { ex . ToString ( ) } ") ;
3664+ if ( ex . Message == "Read past end of stream." )
3665+ {
3666+ // Expected if the process has exited by itself
3667+ // and the event pipe is till trying to read from it
3668+ }
3669+ else
3670+ {
3671+ Log . WriteLine ( $ "[ERROR] { ex . ToString ( ) } ") ;
3672+ }
36633673 }
36643674 finally
36653675 {
@@ -3763,7 +3773,15 @@ private static void StartMeasurement(ServerJob job)
37633773 }
37643774 catch ( Exception ex )
37653775 {
3766- Log . WriteLine ( $ "[ERROR] { ex . ToString ( ) } ") ;
3776+ if ( ex . Message == "Read past end of stream." )
3777+ {
3778+ // Expected if the process has exited by itself
3779+ // and the event pipe is till trying to read from it
3780+ }
3781+ else
3782+ {
3783+ Log . WriteLine ( $ "[ERROR] { ex . ToString ( ) } ") ;
3784+ }
37673785 }
37683786 finally
37693787 {
0 commit comments