Opened on 01/13/2017 at 08:32:23 AM

Closed on 03/13/2017 at 05:27:44 AM

#4794 closed defect (fixed)

adblock engine creating/releasing concurrency

Reported by: asmirnov Assignee: asmirnov
Priority: P2 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: diegocarloslima, fhd Blocked By:
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29371750/

Description

Environment

Adblock engine can be created asynchronously in order not to block main UI: retain(true):
https://hg.adblockplus.org/libadblockplus-android/file/tip/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java#l189

Later we need to make sure creating is finished before getting instance reference: waitForReady():
https://hg.adblockplus.org/libadblockplus-android/file/tip/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java#l141

In the very rare cases the thread can created but not started (https://hg.adblockplus.org/libadblockplus-android/file/tip/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java#l199) when checking for ready as engineCreated instance is still null. So in waitForReady() we will get exception:
https://hg.adblockplus.org/libadblockplus-android/file/tip/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java#l145

How to reproduce

  1. Create adblock engine async with retain(true)
  2. Invoke waitForReady() immediately

Observed behaviour

Getting runtime exception

Expected behaviour

it should wait for the thread to start and block until the instance is created

Attachments (0)

Change History (5)

comment:1 Changed on 01/13/2017 at 11:20:51 AM by asmirnov

comment:2 Changed on 01/13/2017 at 11:38:06 AM by asmirnov

  • Summary changed from adblock engine creating concurrency to adblock engine creating/releasing concurrency

comment:3 Changed on 01/13/2017 at 11:48:17 AM by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:4 Changed on 03/13/2017 at 05:26:22 AM by abpbot

A commit referencing this issue has landed:
Issue 4794 - adblock engine creating/releasing concurrency

comment:5 Changed on 03/13/2017 at 05:27:44 AM by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from asmirnov.
 
Note: See TracTickets for help on using tickets.