farhan678 / adwhirl

Automatically exported from code.google.com/p/adwhirl
0 stars 0 forks source link

CustomAdapter throwing errors into logs rapidly #148

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have an Internet connection
2. Run an app and successfully display and ad
3. Disconnect from the Internet
4. Have the application screen that would be showing the ad visible

What is the expected output? What do you see instead?
System logs fill with:
E/AdWhirl SDK(14425): Caught IOException in getCustom()
E/AdWhirl SDK(14425): java.net.UnknownHostException: cus.adwhirl.com
E/AdWhirl SDK(14425):   at 
java.net.InetAddress.lookupHostByName(InetAddress.java:504)
E/AdWhirl SDK(14425):   at 
java.net.InetAddress.getAllByNameImpl(InetAddress.java:278)
E/AdWhirl SDK(14425):   at 
java.net.InetAddress.getAllByName(InetAddress.java:242)
E/AdWhirl SDK(14425):   at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(Default
ClientConnectionOperator.java:136)
E/AdWhirl SDK(14425):   at 
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
E/AdWhirl SDK(14425):   at 
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapt
er.java:119)
E/AdWhirl SDK(14425):   at 
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirecto
r.java:348)
E/AdWhirl SDK(14425):   at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:5
55)
E/AdWhirl SDK(14425):   at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:4
87)
E/AdWhirl SDK(14425):   at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:4
65)
E/AdWhirl SDK(14425):   at 
com.adwhirl.AdWhirlManager.getCustom(AdWhirlManager.java:177)
E/AdWhirl SDK(14425):   at 
com.adwhirl.adapters.CustomAdapter$FetchCustomRunnable.run(CustomAdapter.java:15
2)
E/AdWhirl SDK(14425):   at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
E/AdWhirl SDK(14425):   at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AdWhirl SDK(14425):   at 
java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AdWhirl SDK(14425):   at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(
ScheduledThreadPoolExecutor.java:114)
E/AdWhirl SDK(14425):   at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedul
edThreadPoolExecutor.java:229)
E/AdWhirl SDK(14425):   at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
E/AdWhirl SDK(14425):   at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
E/AdWhirl SDK(14425):   at java.lang.Thread.run(Thread.java:1096)

These come rapidly (logcat is constantly scrolling in my terminal)

What version of the product are you using? On what operating system?
AdWhirlSDK_Android_2.5.5.jar

Please provide any additional information below.
Sometimes steps 1 and 2 are not necessary, and merely launching an app that 
shows an ad while not having an Internet connection will cause this.

Original issue reported on code.google.com by ob.l...@gmail.com on 23 Nov 2010 at 8:47

GoogleCodeExporter commented 9 years ago
Code path of loop (not sure where it initially gets into this, but it gets 
stuck inside)

AdWhirlLayout.handleAd: line 163, calls the adapter's handleAd
CustomAdapter.handleAd:line 53, schedules a FetchCustomRunnable to run 
immediately
CustomAdapter.FetchCustomRunnable.run: line 154, because there is no network, 
adWhirlLayout.custom is set to null, and adWhirlLayout.rotateThreadedNow() is 
called
AdWhirlLayout.rotateThreadedNow: line 174, schedules RotateAdRunnable to run 
immediately
AdWhirlLayout.RotateAdRunnable.run: line 347, calls rotateAd
AdWhirlLayout.rotateAd: line 147, posts a new HandleAdRunnable to run
AdWhileLayout.HandleAdRunnable.run: line 316, calls handleAd

Theres never an end condition to stop this loop from running if there is no 
network access

Original comment by ob.l...@gmail.com on 23 Nov 2010 at 9:02

GoogleCodeExporter commented 9 years ago
Changing line 154 of CustomAdapter from 
adWhirlLayout.rotateThreadedNow();
to 
adWhirlLayout.rotateThreadedDelayed();
slows down this error to once every 30 seconds, which seems like an exceptable 
retry time for network failures

Original comment by ob.l...@gmail.com on 23 Nov 2010 at 9:27

GoogleCodeExporter commented 9 years ago
I removed the call to adWhirlLayout.rotateThreadedNow on line 154 of 
CustomAdapter (thanks for referencing that btw). It looks like other Adapters 
just give up if they can't fetch the layout. I am not sure if this is the best 
way to handle this, but it works for me because I am manually fetching ads.

if(adWhirlLayout.custom == null) {
    //adWhirlLayout.rotateThreadedNow();
    return;
}

Original comment by jaso...@gmail.com on 29 Nov 2010 at 7:32

GoogleCodeExporter commented 9 years ago
Issue 141 has been merged into this issue.

Original comment by jpin...@google.com on 30 Nov 2010 at 9:47

GoogleCodeExporter commented 9 years ago

Original comment by jpin...@google.com on 30 Nov 2010 at 9:49