-
Notifications
You must be signed in to change notification settings - Fork 769
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
Richaudience: Shared memory fix #2710
Conversation
@@ -52,10 +52,18 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte | |||
} | |||
|
|||
if request.App != nil { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Please remove the leading white space here and for the Site check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
b := &adapters.TypedBid{ | ||
Bid: &seatBid.Bid[i], | ||
Bid: &bidResp.SeatBid[j].Bid[i], | ||
BidType: bidType, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these changes necessary for the bid processing loop? I'm not seeing the issue with the original code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no issues with this. We discussed this with the team and decided this is the right way to do this, similar to how we access Bid by index. I can revert it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to revert this change. There's nothing wrong with the original code and this change is unrelated to the memory corruption.
Arguably, seatBid.Bid[i]
is preferred over bidResp.SeatBid[j].Bid[i]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request.Device.IP
also has a shared memory violation issue. @guscarreon these lines of code are covered by tests, why did the shared memory assertions pass here?
This does not appear to be an infrastructure issue; it's the tests. Let's update the We should make sure that similar adjustments are made to the tests to detect shared memory issues with the device object. |
Good catch about Device.Ip! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@richaudience Can you please confirm (or not) you always expect only 1 impression per request? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Shared memory fix * Minor reference usage fix * Removed empty lines * Code review feedback addressed * Added nil check for req.device
Adapters receive a shallow copy of a request In MakeBids. It means this request has shared pointer values: site, app and other pointer structures are shared between all adapters in request. In order to modify pointer structures you need to create own copy of it and set it back to request.
The reason why previous unit tests didn't show it is because
imp.tagid
was empty and resultapp/site.keywords
didn't change.Please review. @richaudience