[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69BMRKH2MF07GD357PK5S4Q":3,"skill-same:01M69BMRKH2MF07GD357PK5S4Q":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":34,"linkOnly":35,"markdownContent":36,"markdownBody":37,"frontMatter":38,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":42,"repositoryHtmlUrl":43,"repositoryHomepageUrl":17,"ownerHtmlUrl":44,"ownerBlogUrl":45,"ownerDescription":46,"updatedAt":47,"install":48,"resources":61},"01M69BMRKH2MF07GD357PK5S4Q","windbg-user-mutex-held-across-co-await","WinDbg 协程互斥锁挂起排查","Use when app, service, or user-mode driver C++ coroutine code holds a thread-affine lock across suspension and later hangs or fails. Not for all coroutine crashes or choosing lock performance.","当应用、服务或用户态驱动的 C++ 协程代码在挂起点持有线程关联锁，随后发生挂起或失败时使用。不适用于所有协程崩溃场景，也不用于锁的性能选型。","microsoft\u002Fwin-dev-skills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M69BM5T5HHSGVF6KZPTNENXK",510,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-mutex-held-across-co-await\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRSRYQ3M8N5063NNQPF2B1","调试与故障排查","SCENARIO","使用场景",[31,32,33],"windbg user mutex held across co await","performance","code","2026-11-10 10:12:30",false,"---\nname: windbg-user-mutex-held-across-co-await\ndescription: 'Use when app, service, or user-mode driver C++ coroutine code holds a thread-affine lock across suspension and later hangs or fails. Not for all coroutine crashes or choosing lock performance.'\n---\n\n# Mutex Held Across co_await\n\n**Load `windbg-diagnostic-method` first** if it is not already loaded in this\nconversation, and apply it throughout for evidence ranking, hypothesis testing,\nconfidence calibration, independent review, and report validation. This skill\nadds the bug-family-specific commands and evidence requirements.\n\n## Detection\n\nThis pattern can occur in native application, service, or user-mode driver\ncode, including UMDF components that use C++ coroutines. Look for a lock\nacquired before `co_await` and released after resumption or\ncoroutine destruction. Mutex ownership belongs to the acquiring thread, not\nthe coroutine frame. A resumption on another thread can violate that contract.\nEven same-thread resumption can create reentrancy or progress problems when\nthe awaited operation needs a lock the coroutine still holds.\n\n## Workflow\n\n1. Identify the exact lock primitive and acquisition\u002Frelease scope in source.\n   Audit every suspension point while the RAII guard or ownership is alive.\n2. Establish the acquire and resume threads using trace\u002Fsource evidence.\n   Standard mutexes and SRW locks do not provide a universally queryable owner\n   field; do not fabricate an owning TID from undocumented layouts.\n3. Verify the awaiter's resumption contract. C++\u002FWinRT can preserve apartment\n   context for particular awaitables; `resume_background` intentionally switches.\n   Do not assume every WinRT awaitable always resumes on a worker or always on\n   the originating thread.\n4. Distinguish wrong-thread release, a dependency cycle, state changed during\n   suspension, lifetime failure, and unrelated memory corruption.\n5. Move the thread-affine lock into synchronous scopes. Revalidate relevant\n   state after the await rather than treating the pre-await snapshot as current.\n\nIf the symptom is general blocking use `windbg-user-wait-chain-analysis`. For damaged\nheap objects use `windbg-user-heap-corruption-investigation`. If a recording is available,\n`windbg-user-ttd-reverse-debugging-triage` can help establish the ownership timeline.\n\n## Fix pattern\n\nConceptual sequence, not a promise about any particular scheduler:\n\n```text\nunder lock:\n    take a snapshot and its generation\nrelease lock\nawait work using that snapshot\nunder lock on the resumed thread:\n    revalidate generation, lifetime, and assumptions\n    apply result or explicitly handle a stale\u002Fcancelled operation\nrelease lock\n```\n\nUse RAII for each synchronous scope. If invariants cannot tolerate unlocking,\nredesign the operation or use a specifically designed asynchronous coordination\nprimitive with cancellation\u002Flifetime rules. Switching to a recursive mutex or\n`shared_mutex` does not make a thread-affine lock coroutine-safe.\n\nDo not recommend a blanket mutex-type replacement. Shared locking is a separate\ndesign decision; changing the primitive does not repair suspension ownership.\nKeep the object and any captured interfaces alive across asynchronous work.\n\n## Validation\n\n- No thread-affine lock ownership survives a suspension in the corrected path.\n- Each awaiter's thread\u002Fapartment contract is understood.\n- State invariants are revalidated after suspension.\n- Cancellation, concurrent mutation, shutdown, and failed awaited work are tested.\n- The remedy removes the demonstrated cause, not just an observed exception.\n\n## References\n\n- [Holding a lock across coroutine suspension](https:\u002F\u002Fdevblogs.microsoft.com\u002Foldnewthing\u002F20210707-00\u002F?p=105417)\n- [C++\u002FWinRT concurrency and asynchronous operations](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fuwp\u002Fcpp-and-winrt-apis\u002Fconcurrency)\n- [Slim reader\u002Fwriter locks](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fwin32\u002Fsync\u002Fslim-reader-writer--srw--locks)\n\n## Feedback\n\nFollow `FEEDBACK.md` and report reviewed, sanitized feedback to\n[WinDbg-Feedback](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FWinDbg-Feedback\u002Fissues).\nInclude `windbg-user-mutex-held-across-co-await` and the package version from `plugin.json`;\nno automatic source, dump, or transcript upload.\n","# Mutex Held Across co_await\n\n**Load `windbg-diagnostic-method` first** if it is not already loaded in this\nconversation, and apply it throughout for evidence ranking, hypothesis testing,\nconfidence calibration, independent review, and report validation. This skill\nadds the bug-family-specific commands and evidence requirements.\n\n## Detection\n\nThis pattern can occur in native application, service, or user-mode driver\ncode, including UMDF components that use C++ coroutines. Look for a lock\nacquired before `co_await` and released after resumption or\ncoroutine destruction. Mutex ownership belongs to the acquiring thread, not\nthe coroutine frame. A resumption on another thread can violate that contract.\nEven same-thread resumption can create reentrancy or progress problems when\nthe awaited operation needs a lock the coroutine still holds.\n\n## Workflow\n\n1. Identify the exact lock primitive and acquisition\u002Frelease scope in source.\n   Audit every suspension point while the RAII guard or ownership is alive.\n2. Establish the acquire and resume threads using trace\u002Fsource evidence.\n   Standard mutexes and SRW locks do not provide a universally queryable owner\n   field; do not fabricate an owning TID from undocumented layouts.\n3. Verify the awaiter's resumption contract. C++\u002FWinRT can preserve apartment\n   context for particular awaitables; `resume_background` intentionally switches.\n   Do not assume every WinRT awaitable always resumes on a worker or always on\n   the originating thread.\n4. Distinguish wrong-thread release, a dependency cycle, state changed during\n   suspension, lifetime failure, and unrelated memory corruption.\n5. Move the thread-affine lock into synchronous scopes. Revalidate relevant\n   state after the await rather than treating the pre-await snapshot as current.\n\nIf the symptom is general blocking use `windbg-user-wait-chain-analysis`. For damaged\nheap objects use `windbg-user-heap-corruption-investigation`. If a recording is available,\n`windbg-user-ttd-reverse-debugging-triage` can help establish the ownership timeline.\n\n## Fix pattern\n\nConceptual sequence, not a promise about any particular scheduler:\n\n```text\nunder lock:\n    take a snapshot and its generation\nrelease lock\nawait work using that snapshot\nunder lock on the resumed thread:\n    revalidate generation, lifetime, and assumptions\n    apply result or explicitly handle a stale\u002Fcancelled operation\nrelease lock\n```\n\nUse RAII for each synchronous scope. If invariants cannot tolerate unlocking,\nredesign the operation or use a specifically designed asynchronous coordination\nprimitive with cancellation\u002Flifetime rules. Switching to a recursive mutex or\n`shared_mutex` does not make a thread-affine lock coroutine-safe.\n\nDo not recommend a blanket mutex-type replacement. Shared locking is a separate\ndesign decision; changing the primitive does not repair suspension ownership.\nKeep the object and any captured interfaces alive across asynchronous work.\n\n## Validation\n\n- No thread-affine lock ownership survives a suspension in the corrected path.\n- Each awaiter's thread\u002Fapartment contract is understood.\n- State invariants are revalidated after suspension.\n- Cancellation, concurrent mutation, shutdown, and failed awaited work are tested.\n- The remedy removes the demonstrated cause, not just an observed exception.\n\n## References\n\n- [Holding a lock across coroutine suspension](https:\u002F\u002Fdevblogs.microsoft.com\u002Foldnewthing\u002F20210707-00\u002F?p=105417)\n- [C++\u002FWinRT concurrency and asynchronous operations](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fuwp\u002Fcpp-and-winrt-apis\u002Fconcurrency)\n- [Slim reader\u002Fwriter locks](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fwin32\u002Fsync\u002Fslim-reader-writer--srw--locks)\n\n## Feedback\n\nFollow `FEEDBACK.md` and report reviewed, sanitized feedback to\n[WinDbg-Feedback](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FWinDbg-Feedback\u002Fissues).\nInclude `windbg-user-mutex-held-across-co-await` and the package version from `plugin.json`;\nno automatic source, dump, or transcript upload.\n",{"name":5,"description":7},"main","5ce74fa89c49ca353c6ab03bd5889aa519aa9e5e","plugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-mutex-held-across-co-await",41,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-09 06:27:16",{"source":9,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add microsoft\u002Fwin-dev-skills --skill windbg-user-mutex-held-across-co-await",{"tool":54,"command":55},"bunx","bunx skills add microsoft\u002Fwin-dev-skills --skill windbg-user-mutex-held-across-co-await",{"tool":57,"command":58},"pnpm","pnpm dlx skills add microsoft\u002Fwin-dev-skills --skill windbg-user-mutex-held-across-co-await","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-mutex-held-across-co-await\u002FSKILL.md",true,[],[63,79,91,105,120,132],{"skillNo":64,"name":65,"nameZh":66,"description":67,"descriptionZh":68,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":69,"categories":70,"keywords":75,"publishedAt":34},"01M69BN1YCR77KBJHPBB1KBXAB","sample-skill","技能目录测试示例","Sample skill used to test the catalog tooling. Use when testing CI. Not for real work.","用于测试目录工具的示例技能。在测试 CI 时使用。不用于实际工作。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fscripts\u002Ftests\u002Ffixtures\u002Flocal-plugin\u002Fplugins\u002Fsample\u002Fskills\u002Fsample-skill\u002FSKILL.md",[71,72],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":73,"categoryName":74,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSYDSNXQT2W2GMZGF0ZHH4","示例与演示技能",[76,77,78],"sample skill","testing","test",{"skillNo":80,"name":81,"nameZh":82,"description":83,"descriptionZh":84,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":85,"categories":86,"keywords":89,"publishedAt":34},"01M69BMZFWAWBRE71DKPHT282F","windbg-user-wait-chain-analysis","WinDbg 等待链阻塞分析","Use when an app, service, or user-mode driver host is unresponsive on locks, COM\u002FRPC, I\u002FO, or another process; follow the blocker chain. Not for a crash solely from an exception stack.","当应用、服务或用户态驱动宿主程序因锁、COM\u002FRPC、I\u002FO 或其他进程而无响应时，用于追踪阻塞链。不适用于仅由异常栈导致的崩溃。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-wait-chain-analysis\u002FSKILL.md",[87,88],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[90],"windbg user wait chain analysis",{"skillNo":92,"name":93,"nameZh":94,"description":95,"descriptionZh":96,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":97,"categories":98,"keywords":101,"publishedAt":34},"01M69BMX6T725RH7TZK7RDP8YQ","windbg-user-virtual-memory-exhaustion","WinDbg 虚拟内存耗尽分析","Use when a native app, service, or user-mode driver host allocation fails; distinguish VA exhaustion, fragmentation, and commit pressure. Not for managed .NET heap growth, proving a leak from one snapshot, or corruption.","当原生应用、服务或用户态驱动宿主程序分配失败时使用；用于区分虚拟地址（VA）耗尽、碎片化和提交内存（commit）压力。不适用于托管 .NET 堆增长、仅凭单个快照证明内存泄漏，或内存损坏场景。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-virtual-memory-exhaustion\u002FSKILL.md",[99,100],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[102,103,104],"windbg user virtual memory exhaustion","memory","commit",{"skillNo":106,"name":107,"nameZh":108,"description":109,"descriptionZh":110,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":111,"categories":112,"keywords":115,"publishedAt":34},"01M69BMTTSCGTJ6W18YNYDWEVE","windbg-user-ttd-reverse-debugging-triage","WinDbg TTD 时序反向调试分析","Use when an app, service, or user-mode driver host TTD recording is available and earlier calls, writes, or lifetimes matter. Not for kernel replay or history from a normal dump.","当应用、服务或用户态驱动宿主程序有 TTD（Time Travel Debugging）录制，且需要追溯早期的调用、写入或对象生命周期时使用。不适用于内核回放，也不适用于从普通转储文件获取历史记录。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-ttd-reverse-debugging-triage\u002FSKILL.md",[113,114],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[116,117,118,119],"debugging","windbg user ttd reverse debugging triage","triage","kernel",{"skillNo":121,"name":122,"nameZh":123,"description":124,"descriptionZh":125,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":126,"categories":127,"keywords":130,"publishedAt":34},"01M69BMPFX7S3D729F1N89AAP6","windbg-user-heap-corruption-investigation","WinDbg 用户态堆损坏排查","Use when an app, service, or user-mode driver host heap fails or Application Verifier detects corruption; inspect history and bounds. Not for kernel pool corruption or ordinary OOM.","当应用、服务或用户态驱动宿主程序堆分配失败，或 Application Verifier 检测到损坏时使用；可检查历史记录与内存边界。不适用于内核池损坏或普通的内存不足（OOM）。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-heap-corruption-investigation\u002FSKILL.md",[128,129],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[131,119],"windbg user heap corruption investigation",{"skillNo":133,"name":134,"nameZh":135,"description":136,"descriptionZh":137,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":138,"categories":139,"keywords":142,"publishedAt":34},"01M69BMM5G8J8WJWKBWB6J0SA7","windbg-user-exception-triage","用户态异常崩溃分诊","Use when a native C\u002FC++ app, service, or user-mode driver host (including UMDF) crashes with a structured exception in a dump or WinDbg session, including native faults inside managed processes. Not for managed .NET exceptions, WinUI\u002FXAML app errors, or kernel bugchecks.","当本机 C\u002FC++ 应用程序、服务或用户模式驱动程序主机（包括 UMDF）在转储文件或 WinDbg 会话中因结构化异常崩溃时使用，包括托管进程内的本机故障。不适用于托管 .NET 异常、WinUI\u002FXAML 应用错误或内核错误检查（bugcheck）。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwin-dev-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fwindbg\u002Fskills\u002Fwindbg-user-exception-triage\u002FSKILL.md",[140,141],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[143,118,119,144,145],"windbg user exception triage","xaml","winui"]