Opened on 11/01/2016 at 06:10:01 AM

Closed on 12/02/2016 at 05:51:04 AM

Last modified on 12/02/2016 at 05:51:31 AM

#4591 closed defect (fixed)

Crash after dispose

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

https://codereview.adblockplus.org/29361556

Description

Environment

The app uses filterengine for ad-blocking. When the main activity is destroyed we dispose adblock engine and it disposes filterengine. However after few minutes after the app is closed we're getting NRE in native code (sigsegv 11).

How to reproduce

  1. open the app (webviewapp)
  2. go to google.com
  3. navigate random website
  4. close the app (press back)
  5. wait for few minutes
  6. see "app crashed" android message

Observed behaviour

Crash message

Expected behaviour

Nothing happens

Attachments (3)

native_exception.txt (5.2 KB) - added by asmirnov on 11/01/2016 at 06:10:43 AM.
native crash stacktrace
full_log.txt (566.7 KB) - added by asmirnov on 11/01/2016 at 06:11:00 AM.
full log
full_log2.txt (369.1 KB) - added by asmirnov on 11/01/2016 at 01:47:46 PM.

Download all attachments as: .zip

Change History (11)

Changed on 11/01/2016 at 06:10:43 AM by asmirnov

native crash stacktrace

Changed on 11/01/2016 at 06:11:00 AM by asmirnov

full log

Changed on 11/01/2016 at 01:47:46 PM by asmirnov

comment:1 Changed on 11/01/2016 at 02:30:25 PM by asmirnov

this cause NRE (GetJavaVM() returns null)

11-01 10:27:55.264 24316-24366 V/AdblockJNI: JniFilterChangeCallback subscription.lastCheck
void JniFilterChangeCallback::Callback(const std::string& arg,
    const AdblockPlus::JsValuePtr jsValue)
{
  __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "JniFilterChangeCallback %s", arg.c_str());
  JNIEnvAcquire env(GetJavaVM());
...

comment:2 Changed on 11/01/2016 at 07:59:21 PM by asmirnov

everything seems to be allocated and released correctly (checked raw addresses), however callback is invoked after disposing:

11-01 15:51:49.410 13190-13190 V/AdblockJNI: JniFilterChangeCallback JniCtor 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: FilterEngine Ctor 0xb8418ad0
11-01 15:51:50.630 13190-13190 V/AdblockJNI: set filter callback 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.title in 0xb83ce740
11-01 15:51:50.630 13190-13190 V/AdblockJNI: JniFilterChangeCallback subscription.homepage in 0xb83ce740
11-01 15:51:52.230 13190-13276 V/AdblockJNI: JniFilterChangeCallback save in 0xb83ce740
11-01 15:52:17.060 13190-13190 V/AdblockJNI: FilterEngine Dtor 0xb8418ad0
11-01 15:52:17.060 13190-13190 V/AdblockJNI: JniFilterChangeCallback JniDtor 0xb83ce740
11-01 15:52:49.561 13190-13241 V/AdblockJNI: JniFilterChangeCallback subscription.lastCheck in 0xb83ce740

comment:3 Changed on 11/02/2016 at 12:04:59 PM by asmirnov

after removing static callbacks in AdblockEngine:

11-02 07:52:53.720 1843-1843 V/AdblockJNI: JsEngine Ctor
11-02 07:52:55.400 1843-1843 V/AdblockJNI: FilterEngine Ctor 0xb8cf4b10 (using js engine 0xb8cc3550)
11-02 07:53:13.610 1843-1843 V/AdblockJNI: FilterEngine Dtor 0xb8cf4b10
11-02 07:53:13.610 1843-1843 V/AdblockJNI: JsEngine Dtor 0xb8cc3550 (count=6)

still having some references to Js engine.

comment:4 Changed on 11/02/2016 at 12:16:00 PM by asmirnov

relates to #3594

comment:5 Changed on 11/02/2016 at 12:51:28 PM by asmirnov

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

comment:6 Changed on 11/04/2016 at 10:18:08 AM by scheer

  • Tester changed from Unknown to Scheer
  • Verified working set
  • After backing through to the home screen after a page has loaded in step 3, the app no longer crashes.

ABP for Lightning Browser (95)
Galaxy S7
Android 6.0.1

comment:7 Changed on 12/02/2016 at 05:51:04 AM by asmirnov

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

comment:8 Changed on 12/02/2016 at 05:51:31 AM by asmirnov

The source code changes will be included in issue 4399 files

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.