Skip to content

Commit

Permalink
OTT-227 Fixing Panic Issue for Prebid Adapter (#176)
Browse files Browse the repository at this point in the history
* OTT-227 Fixing Panic Issue for Prebid Adapter
  • Loading branch information
pm-viral-vala authored Jul 9, 2021
1 parent 7c2e2d2 commit 62934aa
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,6 @@ func (e *exchange) getAllBids(
reqInfo.PbsEntryPoint = bidderRequest.BidderLabels.RType
bids, err := e.adapterMap[bidderRequest.BidderCoreName].requestBid(ctx, bidderRequest.BidRequest, bidderRequest.BidderName, adjustmentFactor, conversions, &reqInfo, accountDebugAllowed)

// Setting bidderCoreName in SeatBid
bids.bidderCoreName = bidderRequest.BidderCoreName

// Add in time reporting
elapsed := time.Since(start)
brw.adapterBids = bids
Expand All @@ -449,6 +446,9 @@ func (e *exchange) getAllBids(
ae.ResponseTimeMillis = int(elapsed / time.Millisecond)
if bids != nil {
ae.HttpCalls = bids.httpCalls

// Setting bidderCoreName in SeatBid
bids.bidderCoreName = bidderRequest.BidderCoreName
}

// Timing statistics
Expand Down Expand Up @@ -514,9 +514,19 @@ func (e *exchange) recoverSafely(bidderRequests []BidderRequest,
allBidders = sb.String()[:sb.Len()-1]
}

bidderRequestStr := ""
if nil != bidderRequest.BidRequest {
value, err := json.Marshal(bidderRequest.BidRequest)
if nil == err {
bidderRequestStr = string(value)
} else {
bidderRequestStr = err.Error()
}
}

glog.Errorf("OpenRTB auction recovered panic from Bidder %s: %v. "+
"Account id: %s, All Bidders: %s, Stack trace is: %v",
bidderRequest.BidderCoreName, r, bidderRequest.BidderLabels.PubID, allBidders, string(debug.Stack()))
"Account id: %s, All Bidders: %s, BidRequest: %s, Stack trace is: %v",
bidderRequest.BidderCoreName, r, bidderRequest.BidderLabels.PubID, allBidders, bidderRequestStr, string(debug.Stack()))
e.me.RecordAdapterPanic(bidderRequest.BidderLabels)
// Let the master request know that there is no data here
brw := new(bidResponseWrapper)
Expand Down

0 comments on commit 62934aa

Please sign in to comment.