Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbgTransportSession: delete message copy when not queued #50550

Merged
1 commit merged into from
May 24, 2021

Conversation

tmds
Copy link
Member

@tmds tmds commented Apr 1, 2021

This tackles an issue reported by Coverity about pMessageCopy going out-of-scope without being freed.

@ghost
Copy link

ghost commented Apr 1, 2021

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

This tackles an issue reported by Coverity about pMessageCopy going out-of-scope without being freed.

Author: tmds
Assignees: -
Labels:

area-Diagnostics-coreclr

Milestone: -

@@ -628,6 +628,13 @@ HRESULT DbgTransportSession::SendMessage(Message *pMessage, bool fWaitsForReply)
// queue).
pMessage->m_sHeader.m_dwLastSeenId = m_dwLastMessageIdSeen;

// Check the session state.
if (m_eState == SS_Closed)
Copy link
Member Author

Choose a reason for hiding this comment

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

I've moved this check up, so we don't create a message copy to delete it.

// Check the session state.
if (m_eState == SS_Closed)
// If the state is SS_Open we can send the message now.
if (m_eState == SS_Open)
Copy link
Member Author

Choose a reason for hiding this comment

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

This send was moved before the queuing of the message. I assume this is not a problem because we're holding a state lock.


// If the state is SS_Open we can send the message now.
if (m_eState == SS_Open)
else
Copy link
Member Author

Choose a reason for hiding this comment

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

At this point, we're either adding the message to the queue, where the queue reader is responsible for freeing.

Or else we delete when we've allocated a copy.

@tmds
Copy link
Member Author

tmds commented Apr 6, 2021

@janvorli can you take a look?

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

It looks good, but I'd like @mikem8361 to review it to make sure there is no subtle problem.

@janvorli janvorli requested a review from mikem8361 April 6, 2021 15:32
Copy link
Member

@mikem8361 mikem8361 left a comment

Choose a reason for hiding this comment

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

Looks good. I don't see any issues.

@tmds
Copy link
Member Author

tmds commented Apr 29, 2021

@mikem8361 there are CI failures, can you see if they are related? If not, this should be good to merge.

@hoyosjs
Copy link
Member

hoyosjs commented May 24, 2021

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ghost
Copy link

ghost commented May 24, 2021

Hello @hoyosjs!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit d1a0a20 into dotnet:main May 24, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 23, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants