ReleaseSRWLockExclusive - SRW lock must be released by the same thread
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
### Expected behavior
ReleaseSRWLockExclusive [documentation](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-releasesrwlockexclusive?redirectedfrom=MSDN) defines that SRW lock must be released by the same thread that acquired it.
### Actual behavior
The [Application Verifier](https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/application-verifier) generates the following error on Windows 10 Enterprise!
Debugging Details:
------------------
APPLICATION_VERIFIER_SRWLOCK_EXIT_THREAD_OWNS_LOCK (254)
The thread that is exiting or being terminated owns an SRW lock.
This stop is generated if the thread (Param2) that owns the SRW lock (Param1)
is exiting or being terminated.
This will result in an orphaned SRW lock and the threads trying to acquire this
lock would block indefinitely.
$ kb - to get the current stack trace. This is where the thread is exiting or
is being terminated.
$ dps Param3 - to get the SRW lock acquire stack trace.
Arguments:
Arg1: 0000018066385b90, SRW Lock
Arg2: 00000000000017d4, ThreadId of the thread that is exiting or being terminated.
Arg3: 0000018055189b50, Address of the acquire stack trace. Use dps address to see where the SRW lock was acquired.
Arg4: 0000000000000000, Not used
> dps 0000018055189b50
dps 0000018055189b50
00000180`55xxxxxx 0000xxxx`00000000
00000180`xxxxxxxx 0012xxxx`00008801
00000180`xxxxxxxx 0000xxxx`xxxxxxxx vfbasics!AVrfpRtlAcquireSRWLockExclusive+0x61
00000180`xxxxxxxx 0000xxxx`xxxxxxxx vfcuzz!VfCuzzRtlAcquireSRWLockExclusive+0x3b
00000180`xxxxxxxx 0000xxxx`xxxxxxxx xxxxx!Concurrency::details::stl_critical_section_win7::lock+0x1b
00000180`xxxxxxxx 0000xxxx`xxxxxxxx xxxxx!mtx_do_lock+0x108
00000180`xxxxxxxx 0000xxxx`xxxxxxxx xxxxx!_Mtx_lock+0x15
00000180`xxxxxxxx 0000xxxx`xxxxxxxx xxxxx!rocksdb::InstrumentedMutex::Lock+0x108
00000180`xxxxxxxx 0000xxxx`xxxxxxxx xxxxx!rocksdb::DBImpl::Open+0x77f
00000180`xxxxxxxx 0000xxxx`xxxxxxxx xxxxx!rocksdb::DB::Open+0x2c
Contributor guide
Assessment
This issue has not been assessed yet.