Skip to content

Commit

Permalink
Remove hermes_fatal from SamplingProfiler destructor
Browse files Browse the repository at this point in the history
Summary:
This diff removes (temporarily) the requirement that the sampling profiler
should be destroying in the same thread it is created. This unblocks fixes
several (otherwise harmless) crashes.

Reviewed By: neildhar

Differential Revision: D37796218

fbshipit-source-id: f1562e440fa4be7b09b19ba28b6ebc3f1c8988d1
  • Loading branch information
jpporto authored and facebook-github-bot committed Jul 13, 2022
1 parent bb67da1 commit e9eb6b3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 77 deletions.
12 changes: 4 additions & 8 deletions lib/VM/Profiler/SamplingProfilerPosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ void SamplingProfiler::GlobalProfiler::unregisterRuntime(
(void)succeed;

#if defined(__ANDROID__) && defined(HERMES_FACEBOOK_BUILD)
assert(
threadLocalProfilerForLoom_.get() == profiler &&
"invalid hermes runtime for this thread");
// TODO(T125910634): re-introduce the requirement for unregistering the
// runtime in the same thread it was registered.
threadLocalProfilerForLoom_.set(nullptr);
#endif
}
Expand Down Expand Up @@ -409,11 +408,8 @@ SamplingProfiler::SamplingProfiler(Runtime &runtime)
}

SamplingProfiler::~SamplingProfiler() {
if (pthread_self() != currentThread_) {
::hermes::hermes_fatal(
"SamplingProfiler should be destroyed on the same thread it is "
"created");
}
// TODO(T125910634): re-introduce the requirement for destroying the sampling
// profiler on the same thread in which it was created.
GlobalProfiler::get()->unregisterRuntime(this);
}

Expand Down
6 changes: 0 additions & 6 deletions unittests/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ set(APITestsSources
set(APISegmentTestCompileSources
SegmentTestCompile.cpp
)
set(SamplingProfilerSources
SamplingProfilerPosixHermesAPITest.cpp
)

set(HERMES_LINK_COMPONENTS LLVHSupport)

Expand All @@ -39,6 +36,3 @@ target_link_libraries(APITests hermesapi compileJS SegmentTestCompile traceInter

add_hermes_unittest(APILeanTests APILeanTest.cpp)
target_link_libraries(APILeanTests hermesapiLean)

add_hermes_unittest(SamplingProfilerTests ${SamplingProfilerSources})
target_link_libraries(SamplingProfilerTests hermesapiLean hermesVMRuntimeLean)
63 changes: 0 additions & 63 deletions unittests/API/SamplingProfilerPosixHermesAPITest.cpp

This file was deleted.

0 comments on commit e9eb6b3

Please sign in to comment.