Skip to content

Func-eval while runtime is suspended may not run due to deadlock (timing issue) #1537

Closed
@kouvel

Description

@kouvel

One thread may be doing:

  • TieredCompilationManager::TieringDelayTimerCallbackWorker
  • TieredCompilationManager::ResumeCountingCalls
  • MethodDesc::BackpatchToResetEntryPointSlots
  • GCCoop::GCCoop
  • And block for runtime suspension while holding the slot backpatching lock

After runtime suspension, the func-eval thread may be doing:

  • MethodDesc::DoPrestub
  • CodeVersionManager::PublishVersionableCodeIfNecessary
  • MethodDescBackpatchInfoTracker::ConditionalLockHolder::ConditionalLockHolder

It cannot acquire the lock and the func-eval times out. There doesn't seem to be any other instance of notifying the debugger of a cross-thread dependency (though something like NotifyOfCrossThreadDependency) from the VM side. It still wouldn't allow the func-eval to run anyway.

Best way to fix probably would be to not enter cooperative GC mode while holding a regular lock, such that the runtime cannot be suspended while holding the lock. This would mean entering cooperative GC mode before acquiring the lock, requiring that the lock be an unsafe any-mode lock, which in turn means that no GC_TRIGGERS work may be done inside the lock. May be doable, need to see what it would entail.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions