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

AucEnd triggers before all bidResponses with video context + cache #2022

Closed
GeneGenie opened this issue Jan 10, 2018 · 10 comments
Closed

AucEnd triggers before all bidResponses with video context + cache #2022

GeneGenie opened this issue Jan 10, 2018 · 10 comments

Comments

@GeneGenie
Copy link
Contributor

GeneGenie commented Jan 10, 2018

BUG

Description

AucEnd triggers before all bidResponses
screen shot 2018-01-10 at 13 14 20

The issues is that bidResponseCallback is triggering on auction end. And i'm done with my activities.
Then another bidResponse triggers, but nothing happens.

My setup is: 2 adunits, first with vertamediaBidAdapter, the second with appnexusBidAdapter.
Both adunits are instream video

Also tried to set timeout 2 seconds. But it did not help

UPD: it looks like, both adUnits have finished aucs, but both of them are fetching cache UUID. And when first finished the second one is still pending.

@GeneGenie
Copy link
Contributor Author

GeneGenie commented Jan 10, 2018

OuuuuKAY

So I came up with this function for AucEnd triggering

 function bidsBackAll() {
                if (_bidderRequests.every(function (bidRequest) {
                        var videoBidsCount = bidRequest.bids.filter(_video.videoAdUnit).length;
                        var cacheConfigured = !!_config.config.getConfig('cache.url');
                        return bidRequest.doneCbCallCount >= 1 &&
                            (videoBidsCount == 0 ||
                                (videoBidsCount > 0 && !cacheConfigured) ||
                                (videoBidsCount > 0 && cacheConfigured && bidRequest.cacheCbDone )
                            );
                    })) {
                    // when all bidders have called done callback atleast once it means auction is complete
                    utils.logInfo('Bids Received for Auction with id: ' + _auctionId, _bidsReceived);
                    _auctionStatus = AUCTION_COMPLETED;
                    executeCallback(false, true);
                }
            }

But I don't know how to add cacheCbDone to request because responseShould be mapped to request and it's not at current step.
https://github.com/prebid/Prebid.js/blob/master/src/auction.js#L246

OR

function bidsBackAll() {
                if (_videoCache.store.allDone && _bidderRequests.every(function (bidRequest) {
                        return bidRequest.doneCbCallCount;
                    })) {
                    // when all bidders have called done callback atleast once it means auction is complete
                    utils.logInfo('Bids Received for Auction with id: ' + _auctionId, _bidsReceived);
                    _auctionStatus = AUCTION_COMPLETED;
                    executeCallback(false, true);
                }
            }

But it doesn't looks stable.

@mkendall07
Copy link
Member

@GeneGenie
Thanks. We have a fix for this issue here: #2017

@GeneGenie
Copy link
Contributor Author

@mkendall07 Thank you. It is exactly what i'm waiting for.
How long will it take to merge?

I guess i can fork it for now.

@mkendall07
Copy link
Member

should be in a few days.

@matthewlane
Copy link
Collaborator

Closing with #2017 merged

@GeneGenie
Copy link
Contributor Author

@matthewlane found the same issue but it appears within 2 adunits configurations.
The case:
adunit 1 has banner media type and Adbutler bid.
adunit2 has video media type (and additional banner, but I don't think it matters) and Appnexus bids and cache config.

As soon as adbutler finishes loading, auction is ending before cache responds.
I guess that part responsible for that is: https://github.com/prebid/Prebid.js/blob/master/src/adapters/bidderFactory.js#L181

which finalises whole auction when Adunit1 is done, coz it has no video configured.

Should this issue be reopened?

@matthewlane
Copy link
Collaborator

@GeneGenie I'm trying to recreate this setup locally, can you post your setup (prebid adunits, setConfig, etc.) here (either in this issue, a link to a test page, or a link to something like jsfiddle). Also which version of prebid are you using?

@GeneGenie
Copy link
Contributor Author

GeneGenie commented Mar 1, 2018

@matthewlane sure.

vmpbjs.addAdUnits([
    {
        "bids": [
            {
                "type": "display",
                "bidder": "adbutler",
                "params": {
                    "accountID": "169206",
                    "zoneID": "268389"
                }
            }
        ],
        "type": "display",
        "code": "slot1",
        "mediaTypes": {
            "banner": {
                "sizes": [
                    [
                        300,
                        250
                    ],
                    [
                        300,
                        600
                    ]
                ]
            }
        }
    },
    {
        "bids": [
            {
                "type": "display",
                "bidder": "vertamedia",
                "params": {
                    "aid": "348408"
                }
            }
        ],
        "type": "display",
        "code": "slot3",
        "mediaTypes": {
            "banner": {
                "sizes": [
                    [
                        300,
                        250
                    ]
                ]
            }
        }
    },
    {
        "bids": [
            {
                "type": "display",
                "bidder": "vertamedia",
                "params": {
                    "aid": "350975"
                }
            }
        ],
        "type": "display",
        "code": "slot4",
        "mediaTypes": {
            "banner": {
                "sizes": [
                    [
                        300,
                        250
                    ],
                    [
                        300,
                        600
                    ]
                ]
            }
        }
    },
    {
        "bids": [
            {
                "type": "video",
                "bidder": "vertamedia",
                "params": {
                    "aid": "331133"
                }
            }
        ],
        "type": "video",
        "code": "slotX",
        "mediaTypes": {
            "video": {
                "context": "instream"
            },
            "sizes": [
                [
                    300,
                    250
                ]
            ]
        }
    }
]);
 vmpbjs.setConfig({
   cache: {
       url: 'https://prebid.adnxs.com/pbc/v1/cache'
   },
   enableSendAllBids: false,
   bidderTimeout: 3000,
   priceGranularity: 'high'
});
vmpbjs.requestBids(/*.....*/)

It happens 50/50 times
I was able to reproduce it when adbutler ads response before videoRequest (Even used sniffer to delay particular cache request)

Hope that helps.
When i placed debugger in auctionEnd event handler when only 3 bids available, it showed me this place https://github.com/prebid/Prebid.js/blob/master/src/adapters/bidderFactory.js#L181
with a context of adbutler.

Using Prebid 1.4.0

@GeneGenie
Copy link
Contributor Author

This is what happens
screen shot 2018-03-02 at 01 13 53

Last bid response comes after auction end event, and after bidsBackHandler which is executing setTargeting

@matthewlane
Copy link
Collaborator

@GeneGenie Great, thanks, I'm able to reproduce the issue with this setup (and one tweak, in the last ad unit, sizes should either be a sibling of mediaTypes, or a child of mediaTypes.video (rather than a child of mediaTypes directly) with the name playerSize like

  mediaTypes: {
    video: {
      context: 'instream',
      playerSize: [300, 250]
    }
  }

). Will update when i have a fix or more info

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

No branches or pull requests

3 participants