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

setTimeout isn't cleared when auction ends before its timeout #699

Closed
dugwood opened this issue Oct 12, 2016 · 6 comments
Closed

setTimeout isn't cleared when auction ends before its timeout #699

dugwood opened this issue Oct 12, 2016 · 6 comments
Assignees
Labels

Comments

@dugwood
Copy link
Contributor

dugwood commented Oct 12, 2016

As reported here: #647 (comment)

For example, I run 2 calls to requestBids(), with a timeout of 1000ms. Prebid.js is already loaded when I call the pbjs.que.push()
Here is the result, the first column is the time relative to my own script:

first placement:
    2 Starting bids: 4 bidders (just before the requestBids call)
  321 appnexus:   0.114   x 0.87  = 0.099   (CPM: 0.25, Time: 316)
  664 criteo:     0.04    x 1     = 0.04    (CPM: 0.25, Time: 655)
  757 rubicon:    0       x 0.885 = 0       (CPM: 0.25, Time: 748)
  866 rubicon:    2.222   x 0.885 = 1.966   (CPM: 0.25, Time: 858)
  870 Handling bids (=bidsBackHandler)
  870 bid #0: appnexus  CPM: 0      Time: 316
  870 bid #1: criteo    CPM: 0      Time: 655
  870 bid #2: rubicon   CPM: 0      Time: 748
  871 bid #3: rubicon   CPM: 1.966  Time: 858
  885 Winner: rubicon (price bucket: 1.90)

second placement:
   11 Starting bids: 4 bidders (just before the requestBids call)
 1098 Handling bids (=bidsBackHandler)
 1098 No bid
 1119 appnexus:   0.368   x 0.87  = 0.32    (CPM: 0.3, Time: 231)
 1288 criteo:     0.17    x 1     = 0.17    (CPM: 0.3, Time: 395)

As you can see: the pbjs.que.push function is run at 2 and 11ms. The first placement works fine, all bidders answer within 1 second.

But the second placement shows that bidsBackHandler is launch at the timeout of the first placement (around 1000ms, here it's 1098ms).

So the second placement is always blocked by the first one. And bids were rendered within 1s: AppNexus answers in 231ms, so it wasn't started at 11ms, but around 1098-231=867ms, just around the first placement run its bidsBackHandler.

@dugwood
Copy link
Contributor Author

dugwood commented Oct 12, 2016

I'm currently working on a fix, to send a clearTimeout at the right moment.

@dugwood
Copy link
Contributor Author

dugwood commented Oct 12, 2016

Also found a bug for the second call of requestBids(): the timeout isn't correctly set, because the argument name isn't cbTimeout but timeout. Hence the timeout is always set to pbjs.bidderTimeout for the second auction.
Currently testing a fix for both issues.

@dugwood dugwood mentioned this issue Oct 12, 2016
8 tasks
@dugwood
Copy link
Contributor Author

dugwood commented Oct 13, 2016

See: #643 (comment)

I don't understand the need for past auctions, as we remove all «completed», why do we keep the failed ones? This create all sort of bugs...

@mkendall07
Copy link
Member

We need to keep them around in case the bid we send to DFP or adserver actually wins the final auction, so in that case renderAd can lookup and find the bid to display.

Also we can't remove bids that have been set and not won because it's possible they could be sent again in the future.

@dugwood
Copy link
Contributor Author

dugwood commented Oct 14, 2016

@mkendall07 I agree on the DFP part, and I'll let the bids available. For the bids not set... what do you mean exactly? If there's no bid (or the bid returns after the timeout), there's no need for those bids anymore, don't you think? I would have removed them in the first place (based on auctionRunning === false and/or adUnitCode isn't being the one currently in auction, so addBidResponse will ignore those bids).

@protonate protonate self-assigned this Oct 17, 2016
@mkendall07 mkendall07 added the bug label Oct 17, 2016
@dugwood dugwood mentioned this issue Oct 22, 2016
8 tasks
@dugwood
Copy link
Contributor Author

dugwood commented Oct 22, 2016

Should be fixed when PR #735 will be merged.

@dugwood dugwood closed this as completed Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants