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

Rubicon: Initial ORTB 2.6 support #2536

Merged
merged 7 commits into from
Apr 10, 2023

Conversation

CTMBNara
Copy link
Contributor

No description provided.

Comment on lines 236 to 247
requestCopy, err := copystructure.Copy(request)
if err != nil {
return nil, []error{err}
}

requestDeepCopy := requestCopy.(*openrtb2.BidRequest)
err = openrtb_ext.ConvertUpTo26(&openrtb_ext.RequestWrapper{BidRequest: requestDeepCopy})
if err != nil {
return nil, []error{err}
}

request = requestDeepCopy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SyntaxNode Hi. Is there another best way to do conversion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@onkarvhanumante, can you answer please? ^^

@bretg
Copy link
Contributor

bretg commented Jan 30, 2023

@CTMBNara - please also downgrade user.consent to user.ext.consent. Thanks!

@@ -15,6 +15,7 @@ type ExtImpRubicon struct {
Visitor json.RawMessage `json:"visitor,omitempty"`
Video rubiconVideoParams `json:"video"`
Debug impExtRubiconDebug `json:"debug,omitempty"`
PChain string `json:"pchain,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

should create docs PR to include description for this pchain bidder param (rubicon.md)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm actually pushing to get rid of this deprecated param entirely, but went ahead and added it to the docs so this PR can be merged. We'll remove it as a separate effort if I get the ok . prebid/prebid.github.io#4397

Comment on lines 237 to 240
requestCopy, err := copystructure.Copy(request)
if err != nil {
return nil, []error{err}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

copy method used is not preferred here. How about simply assigning request to new var and using it

requestCopy := request

Copy link
Contributor

@onkarvhanumante onkarvhanumante left a comment

Choose a reason for hiding this comment

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

left one comment

@onkarvhanumante
Copy link
Contributor

@CTMBNara any updates on this PR

@CTMBNara CTMBNara requested review from onkarvhanumante and removed request for Sonali-More-Xandr March 30, 2023 13:47
@onkarvhanumante
Copy link
Contributor

@CTMBNara, Rubicon adapter tests are failing since 3c1751e changes. Could you fix them.

@CTMBNara
Copy link
Contributor Author

CTMBNara commented Apr 3, 2023

@CTMBNara, Rubicon adapter tests are failing since 3c1751e changes. Could you fix them.

@onkarvhanumante This problem is caused by openrtb_ext.ConvertUpTo26. It's the method that modifies BidRequest. Since we are now simply passing it the same BidRequest that we are passing in MakeRequests, a Data race ... error occurs.

To fix this, we need to go back to the previous solution or do a convert before MakeRequests.

@CTMBNara CTMBNara requested a review from bretg April 3, 2023 10:24
@bretg bretg removed their request for review April 3, 2023 13:17
Comment on lines 236 to 244
requestCopy := request

err := openrtb_ext.ConvertUpTo26(&openrtb_ext.RequestWrapper{BidRequest: requestCopy})
if err != nil {
return nil, []error{err}
}

request = requestCopy

Copy link
Contributor

Choose a reason for hiding this comment

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

MakeRequest should not modify original request. This is a part of JSON test verification. It's easy to accidentally modify a property (or sub-object) in a shallow copy of an object such as any pointer in a bid request: Site *Site, App *App, Device *Device, User *User, etc.

This code is what is causing the race condition error.

ConvertUpTo26 sets User.Eids to original request and requestCopy because user is the same object in memory in both of them.

To fix this issue user should be copied from the original request and set back to requestCopy so requestCopy has its own user.

Insert this code after line 236:

if request.User != nil {
		userCopy := *request.User
		requestCopy.User = &userCopy
	}

This fixes race condition error

@VeronikaSolovei9
Copy link
Contributor

Thank you for the changes. Please keep in mind you will need to make a copy of other sub-objects if you will make changes in them.
Code looks good to me.
@onkarvhanumante please re-review.

@VeronikaSolovei9 VeronikaSolovei9 merged commit 4cb42fc into prebid:master Apr 10, 2023
blueseasx pushed a commit to blueseasx/prebid-server that referenced this pull request Jun 2, 2023
bretg added a commit that referenced this pull request Aug 20, 2024
This was done a while ago in #2536
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.

6 participants