Monday, January 20, 2014

AsyncTask multithreading cause Fatal signal 11 (SIGSEGV)


posts by Kevenshao on 2013-12-12 11:13:51 Edit
I set AsyncTask thread pool three concurrent execution threads, asynchronous updates to listview picture, when fast paddling listview, resulting in force close, I do not know how to solve such problems, please enlighten colleagues encountered.

[Version]
Android SDK4.0.3 version 4.2.2 running on a mobile phone

[Class]
AsyncTask public static final Executor mExec = new ThreadPoolExecutor (3, 200, 1, TimeUnit.SECONDS, new LinkedBlockingQueue ());

class CanvasImageTask extends AsyncTask {
/ / ....... On the network to download the pictures and set
}


[Call]
Object obj [] = new Object [2];
obj [0] = view;
obj [1] = iconUrl;
. new CanvasImageTask (true) executeOnExecutor (mExec, obj);


[Log]
D / SurfaceFlinger (134): requestNextVsync (134)

D / DisplayEventReceiver (19287): rev (0x5c8fe428) w / vsync, t = 501324316513052, id = 0, c = 7997046

D / SurfaceFlinger (134): requestNextVsync (19287)

D / InputReader (556): AP_PROF: AppLaunch_dispatchPtr: Down: 501324364

D / SurfaceFlinger (134): requestNextVsync (134)

I / View (19287): Touch down dispatch to android.widget.ListView {41b1ecd0 VFED.VC. F. ... I. 6,6-534,680 # 7f0b00a0 app:. Id / rank_list}, event = MotionEvent {action = ACTION_DOWN, id [0] = 0, x [0] = 295.44177, y [0] = 485.28406, toolType [0] = TOOL_TYPE_FINGER, buttonState = 0, metaState = 0, flags = 0x0, edgeFlags = 0x0, pointerCount = 1, historySize = 0, eventTime = 501324364, downTime = 501324364, deviceId = 3, source = 0x1002}

D / AbsListView (19287): Touch down: touch mode = 6, mScrollY = 2, y = 485.28406, mFirstPosition = 663, mActivePointerId = -1, mDataChanged = false, adatper size = 670, this = android.widget.ListView {41b1ecd0 VFED.VC. F. ... I. 6,6-534,680 # 7f0b00a0 app:. id / rank_list}

D / AbsListView (19287): endFling: mScrollY = 2, mTouchMode = 6, mFirstPosition = 663

D / SurfaceFlinger (134): postEvent (134, v / c = 7997049)

D / SurfaceFlinger (134): postEvent (19287, v / c = 7997049)

D / SurfaceFlinger (134): requestNextVsync (134)

D / SurfaceFlinger (134): requestNextVsync (134)

D / DisplayEventReceiver (19287): rev (0x5c8fe428) w / vsync, t = 501324372516591, id = 0, c = 7997049

D / SurfaceFlinger (134): requestNextVsync (19287)

E / mtk_dlmalloc_debug (19287): [DEBUG_INFO] bug detected at function do_check_inuse_chunk Line 4374

E / mtk_dlmalloc_debug (19287): [DEBUG_INFO] address 60e8bd50 function 1 action 1625865560 structure type 4 error_member 20 mstate 40157c48

E / mtk_dlmalloc_debug (19287):

E / mtk_dlmalloc_debug (19287): ======================== DUMP RUNTIME CHECKING DEBUGGER INFO ============== ==========

E / mtk_dlmalloc_debug (19287): === Error structure Address: 0x60e8bd50

E / mtk_dlmalloc_debug (19287): === Function: dlfree (1)

E / mtk_dlmalloc_debug (19287): === Action: check top (16)

E / mtk_dlmalloc_debug (19287): === structure type: Inuse chunk (0x4)

E / mtk_dlmalloc_debug (19287): === Error member: head_current_free_bit (0x20)

E / mtk_dlmalloc_debug (19287): === GM: 0x40157c48

E / mtk_dlmalloc_debug (19287): === MSTATE: 0x40157c48

E / mtk_dlmalloc_debug (19287): ======================== ANALYZE ERROR TYPES ================ ========

D / SurfaceFlinger (134): postEvent (134, v / c = 7997050)

D / SurfaceFlinger (134): postEvent (19287, v / c = 7997050)

E / mtk_dlmalloc_debug (19287): [ERROR] Double Free at Chunk 60e8bd50
!!!
E / libc_malloc_mtk_debug (19287): No backtrace becasue Debug15 is disable

E / mtk_dlmalloc_debug (19287): ======================== SHOW ERROR STRUCTURE ================ ========

E / mtk_dlmalloc_debug (19287): === ERROR structure: INUSE CHUNK

E / mtk_dlmalloc_debug (19287): === SHOW CHUNK and error member: 0x20

E / mtk_dlmalloc_debug (19287): === CHUNK address: 0x60e8bd50

E / mtk_dlmalloc_debug (19287): === CHUNK prev_foot: 0x3975a5f1

E / mtk_dlmalloc_debug (19287): === CHUNK size: 896

E / mtk_dlmalloc_debug (19287): === CHUNK MMAPED bit: 0x0

E / mtk_dlmalloc_debug (19287): === CHUNK PRE_CHUNK IN USE: 0x1

E / mtk_dlmalloc_debug (19287): === CHUNK CURRENT CHUNK_IN USE: 0x0

E / mtk_dlmalloc_debug (19287): ^ ^ ^ ^ ^ ^ ^ ^ wrong current in use bit:

E / mtk_dlmalloc_debug (19287): === CHUNK fencepost bit is: 0x1 (last three bit)

E / mtk_dlmalloc_debug (19287): ======================== SHOW ERROR STRUCTURE END =============== =========

E / mtk_dlmalloc_debug (19287): ======================== START TO DO CHUNK OVERFLOW DETECTION ============= ===========

E / mtk_dlmalloc_debug (19287): ======================== CHUNK OVERFLOW DETECTION DONE =============== =========

E / mtk_dlmalloc_debug (19287): ======================== START TO SCAN smallbin, treebin and ALL CHUNKS ========== ==============

E / mtk_dlmalloc_debug (19287): ======================== CHECK ALL CHUNKS DONE =============== =======

E / mtk_dlmalloc_debug (19287): [DEBUG_INFO] CALL ABORT FUNCTION

F / libc (19287): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code = 1), thread 19395 (pool-1-thread-1)

F / libc (19287): Send stop signal to pid: 19287 in debugger_signal_handler

D / AEE / AED (126): $ === AEE === AEE === AEE === $

D / AEE / AED (126): p 0 poll events 1 revents 0

D / AEE / AED (126): not know revents: 0

D / AEE / AED (126): p 1 poll events 1 revents 0

D / AEE / AED (126): not know revents: 0

D / AEE / AED (126): p 2 poll events 1 revents 1

D / AEE / AED (126): aed_main_fork_worker: generator 0x3a4168, worker 0xbea7f9f8, recv_fd 15

D / PowerManagerService (556): userActivityFromNative

D / PowerManagerService (556): userActivityNoUpdateLocked: eventTime = 501324423, event = 2, flags = 0x0, uid = 1000

D / PowerManagerNotifier (556): onUserActivity: event = 2, uid = 1000

D / PowerManagerService (556): updateUserActivitySummaryLocked: mWakefulness = Awake, mUserActivitySummary = 0x1, nextTimeout = 501377423 (in 52999 ms)

D / PowerManagerService (556): newScreenState = 2

D / PowerManagerDisplayController (556): requestPowerState: screenState = 2, useProximitySensor = false, forceProximitySensorEnable = false, screenBrightness = 65, screenAutoBrightnessAdjustment = 0.0, useAutoBrightness = false, useEcoBrightness = false, blockScreenOn = false, waitForNegativeProximity = false

I / PowerManagerService (556): setBrightness mButtonLight 0
.
D / PowerManagerService (556): updateScreenStateLocked: mDisplayReady = true, newScreenState = 2, mWakefulness = 1, mWakeLockSummary = 0x0, mUserActivitySummary = 0x1, mBootCompleted = true

D / AEE / AED (126): p 3 poll events 1 revents 0

D / AEE / AED (126): not know revents: 0

D / AEE / AED (126): p 4 poll events 1 revents 0

D / AEE / AED (126): not know revents: 0

I / DEBUG (19546): handle_request (15)
Reply:
Executor mExec = new ThreadPoolExecutor
This is passed to CanvasImageTask what to do with,

This picture does not need multiple threads asynchronously update the thread pool,
Examples of 2,3 threads batches updated picture on OK.
Reply:
cited a floor birdsaction reply:
Executor mExec = new ThreadPoolExecutor
This is passed to CanvasImageTask what to do with,

This picture does not need multiple threads asynchronously update the thread pool,
Examples of 2,3 threads batches updated picture on OK.

android 3.0 later, AsyncTask is single-threaded execution, that is only one thread in the thread pool to run, other tasks will wait,
Executor mExec = new ThreadPoolExecutor purpose is to set the thread pool has multiple threads concurrently.
Choose to use AsyncTask, because it has a thread pool, do not destroy threads frequently create more efficient.
Reply:
Did not notice this to my own previous update ListView are directly open 2-3 threads batch load images,
Many individuals do not think it needs to open the thread, if you have more than one N Item ListView need to download the picture, it could lead to excessive memory consumption.
Thread pool, it can not immediately use on, for example, network congestion when many threads will not be able to perform timely completion.
Reply:
UP own roof bars
Reply:
The reply was deleted administrator at 2013-12-14 12:12:31

Reply:
Problem solving, not the cause of the thread pool, but other parts of the code caused thread deadlock

No comments:

Post a Comment