Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

Harlan Ad Server
Project Home Known Issues Contact Project

Harlan Ad Server Issue: Lock Issue on adserver.cfm

Name: Lock Issue on adserver.cfm
ID: 3
Project: Harlan Ad Server
Type: Bug
Area: Code
Severity: Normal
Status: Open
Related URL:
Creator: Shawn Holmes
Created: 08/07/09 1:00 AM
Updated: 09/23/09 1:49 PM
Description: Found a bug in the core Harlan files today you might want to be aware of. If you pop open adserver.cfm and see this:

<cfif not isDefined("picked")>
<cfset data.marker = 1>
<cfset picked = data.ads.adidfk[1]>
</cfif>
</cflock>

<!--- Ok, now we have a ad, we can get the source and increment impressions --->
<cfset bean = application.admanager.getAdImpression(picked,campaign.getID())>

You are going to want to change it to this:

<cfif not isDefined("picked")>
<cfset data.marker = 1>
<cfset picked = data.ads.adidfk[1]>
</cfif>

<!--- Ok, now we have a ad, we can get the source and increment impressions --->
<cfset bean = application.admanager.getAdImpression(picked,campaign.getID())>
</cflock>

I tracked this down while researching an issue with our implementation of it and noticing that, when a campaign was being accessed, as it poured through the data query attempting to determine which ad was next in the rotation, if the campaign was set up such that no ads matched the current date/time criteria, it would have to default to "something", which is what's happening there in your isDefined() check. However, once the picked value was assigned, and passed to getAdImpression(), I was noticing ads showing up that weren't a part of the campaign at all. Alas, campaign is created in an entirely separate lock. There is a very small chance that multiple requests can cross-over their assignment of the 'picked' var, and subsequent load of getAdImpression(), using the wrong campaign as its parent.
History: Created by Hanzo (Shawn Holmes) : 08/07/09 1:00 AM

Comment by chiponium (Alicia) : 09/01/09 3:24 PM
I have noticed that ads will duplicate on firefox after upgrading from 3.0 to 3.5. I've tried your fix hoping to see a difference, but was unsuccessful.

Comment by Hanzo (Shawn Holmes) : 09/23/09 1:49 PM
I've since had to go back and make further changes. It is not enough to just lock the bean read from the campaign call to getAdImpression()--the entire load must be locked from either call, otherwise, multiple atomic calls will step on each others toes. I notice that the new Harlan update has a lock around both calls to getAdImpression(), which should do the trick.

On our end, I re-wrote the calls slightly so that the entire load and display is locked, and moved the display functionality to a function. The end looks very much like this:

<cfif not isDefined("picked")>
      <cfset data.marker = 1>
      <cfset picked = data.ads.adidfk[1]>
   </cfif>

   <!--- Ok, now we have a ad, we can get the source and increment impressions --->
   <cfset bean = application.admanager.getAdImpression(picked,campaign.getID())>
   
      <cfif bean.getID() neq "" and bean.getActive()>
<cfoutput>document.write('#getText(bean, campaign)#');</cfoutput>
      </cfif>   
   </cflock>

<cfelse>

   <cflock name="#application.lockname#" type="exclusive" timeout="30">
      <cfparam name="url.a" default="">
   
      <cfset bean = application.admanager.getAdImpression(url.a)>
   
      <cfif bean.getID() neq "" and bean.getActive()>
<cfoutput>document.write('#getText(bean)#');</cfoutput>
      </cfif>
   </cflock>

To add a comment to this bug, please login using the link above.