summaryrefslogtreecommitdiff
path: root/src/vm/eventpipe.cpp
diff options
context:
space:
mode:
authorJosé Rivero <jorive@microsoft.com>2019-04-18 13:18:26 -0700
committerGitHub <noreply@github.com>2019-04-18 13:18:26 -0700
commitb874895d6ec17d51d9f4b271fb878f89ce674543 (patch)
tree7ae6f57311686c3d20138c1660f82739e15b69e9 /src/vm/eventpipe.cpp
parentaf83b8ad6fe02b45321741e26d996ee4b738d67f (diff)
downloadcoreclr-b874895d6ec17d51d9f4b271fb878f89ce674543.tar.gz
coreclr-b874895d6ec17d51d9f4b271fb878f89ce674543.tar.bz2
coreclr-b874895d6ec17d51d9f4b271fb878f89ce674543.zip
If IPC connections fails, then remove active session. (#24082)
Diffstat (limited to 'src/vm/eventpipe.cpp')
-rw-r--r--src/vm/eventpipe.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/vm/eventpipe.cpp b/src/vm/eventpipe.cpp
index dc94c2b451..b6ec530110 100644
--- a/src/vm/eventpipe.cpp
+++ b/src/vm/eventpipe.cpp
@@ -351,6 +351,19 @@ void EventPipe::Disable(EventPipeSessionID id)
// Take the lock before disabling tracing.
CrstHolder _crst(GetLock());
+ DisableInternal(reinterpret_cast<EventPipeSessionID>(s_pSession));
+}
+
+void EventPipe::DisableInternal(EventPipeSessionID id)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_ANY;
+ PRECONDITION(GetLock()->OwnedByCurrentThread());
+ }
+ CONTRACTL_END;
if (s_pConfig != NULL && s_pConfig->Enabled())
{
@@ -503,6 +516,8 @@ void WINAPI EventPipe::FlushTimer(PVOID parameter, BOOLEAN timerFired)
}
CONTRACTL_END;
+ GCX_PREEMP();
+
// Take the lock control lock to make sure that tracing isn't disabled during this operation.
CrstHolder _crst(GetLock());
@@ -513,8 +528,6 @@ void WINAPI EventPipe::FlushTimer(PVOID parameter, BOOLEAN timerFired)
if (!Enabled() || s_pSession->GetSessionType() != EventPipeSessionType::IpcStream)
return;
- GCX_PREEMP();
-
if (CLRGetTickCount64() > (s_lastFlushSwitchTime + 100))
{
// Get the current time stamp.
@@ -526,6 +539,16 @@ void WINAPI EventPipe::FlushTimer(PVOID parameter, BOOLEAN timerFired)
s_lastFlushSwitchTime = CLRGetTickCount64();
}
+
+ if (s_pFile->HasErrors())
+ {
+ EX_TRY
+ {
+ DisableInternal(reinterpret_cast<EventPipeSessionID>(s_pSession));
+ }
+ EX_CATCH {}
+ EX_END_CATCH(SwallowAllExceptions);
+ }
}
EventPipeSession *EventPipe::GetSession(EventPipeSessionID id)