Skip to content

Conversation

@natiskan
Copy link
Contributor

Avoid holding locks in winhttp_http_task when calling into externally provided event handler functions on completion callback.

natiskan added 3 commits May 12, 2021 17:47
…ividual callback type handlers to avoid holding onto lock when calling into externally provided event handlers
HRESULT hr = HCHttpCallRequestGetUrl(pRequestContext->m_call, &method, &url);
if (SUCCEEDED(hr))
{
win32_cs_autolock autoCriticalSection(&pRequestContext->m_lock);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be release prior to calling complete_task? Does that synchronously call back into client's code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it can, but XSAPI doesn't currently use this. I've updated the PR to not hold locks for complete_task.

_In_ winhttp_http_task* pRequestContext,
_In_ void* statusInfo)
{
win32_cs_autolock autoCriticalSection(&pRequestContext->m_lock);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as above

@natiskan natiskan merged commit 84c913f into microsoft:main May 14, 2021
natiskan added a commit that referenced this pull request May 18, 2021
… when calling into websocket event functions (#580)

* Move winhttp_http_task completion_callback lock handling into the individual callback type handlers to avoid holding onto lock when calling into externally provided event handlers

* Move duplicate XAsyncComplete checking to compete_task

* tabs -> spaces

* don't hold lock for complete_task since it can call back into client code synchronously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants