Last Comment Bug 747873 - Provide error information when input configuration not properly initialized
: Provide error information when input configuration not properly initialized
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget (show other bugs)
: unspecified
: All Gonk (Firefox OS)
: -- normal (vote)
: mozilla15
Assigned To: Cervantes Yu [:cyu] [:cervantes]
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-23 03:36 PDT by Cervantes Yu [:cyu] [:cervantes]
Modified: 2012-05-26 15:27 PDT (History)
2 users (show)
ryanvm: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Add MOZ_NOT_REACHED() in code path that should never be reached (1.01 KB, patch)
2012-04-24 03:29 PDT, Cervantes Yu [:cyu] [:cervantes]
mwu.code: review+
Details | Diff | Splinter Review

Description Cervantes Yu [:cyu] [:cervantes] 2012-04-23 03:36:16 PDT
STR:
* on the device mv /system/usr/idc/sec_touchscreen.idc /system/usr/idc/sec_touchscreen.idc.bak to simulate idc file missing
* restart b2g and touch the home screen
* b2g reloads

Under some corner cases the device's input configuration is not properly configured. Files under /system/usr/idc/ can be missing and pointer device is initialized to default. When this happens, b2g process gets segv on touch. Here is the gdb session showing the symptom

-----------------------
Breakpoint 1, GeckoInputReaderPolicy::obtainPointerController (this=0x422fb1c0, deviceId=6) at /home/cervantes/hg/mozilla-central/widget/gonk/nsAppShell.cpp:281
281         virtual sp<PointerControllerInterface> obtainPointerController(int32_t
(gdb) bt
#0  GeckoInputReaderPolicy::obtainPointerController (this=0x422fb1c0, deviceId=6) at /home/cervantes/hg/mozilla-central/widget/gonk/nsAppShell.cpp:281
#1  0x8297507c in android::TouchInputMapper::configureSurface (this=0x3a670, when=<optimized out>, outResetNeeded=0x43fffdb7) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:2694
#2  0x8297656e in android::TouchInputMapper::configure (this=0x3a670, when=1335175995285881000, config=0x43da2020, changes=0) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:2500
#3  0x8296cf6c in android::InputDevice::configure (this=0x39168, when=1335175995285881000, config=0x43da2020, changes=0) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:910

...(some lines are omitted)

Program received signal SIGSEGV, Segmentation fault.
android::TouchInputMapper::preparePointerGestures (this=0x3a670, when=1335176027728114000, outCancelPreviousGesture=0x43fffd37, outFinishPreviousGesture=0x43fffd36, isTimeout=<optimized out>)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:4533
4533            mPointerController->getPosition(&x, &y);
(gdb) bt
#0  android::TouchInputMapper::preparePointerGestures (this=0x3a670, when=1335176027728114000, outCancelPreviousGesture=0x43fffd37, outFinishPreviousGesture=0x43fffd36, isTimeout=<optimized out>)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:4533
#1  0x829725fc in android::TouchInputMapper::dispatchPointerGestures (this=0x0, when=<optimized out>, policyFlags=0, isTimeout=48)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3959
#2  0x82972d48 in android::TouchInputMapper::dispatchPointerUsage (this=0x3a670, when=1335176027728114000, policyFlags=0, pointerUsage=android::TouchInputMapper::POINTER_USAGE_GESTURES)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3923
#3  0x82973ac4 in android::TouchInputMapper::sync (this=0x3a670, when=1335176027728114000) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3423
#4  0x82973c36 in android::TouchInputMapper::process (this=0x3a670, rawEvent=0x43da2180) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:3299
#5  0x82973c4c in android::MultiTouchInputMapper::process (this=0x0, rawEvent=0x43fff778) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:5571
#6  0x82976634 in android::InputDevice::process (this=0x39168, rawEvents=<optimized out>, count=1) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:961
#7  0x829766a4 in android::InputReader::processEventsForDeviceLocked (this=<optimized out>, deviceId=6, rawEvents=0x43da20c0, count=7)
    at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:459
#8  0x82977428 in android::InputReader::processEventsLocked (this=0x43da2000, rawEvents=<optimized out>, count=7) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:321
#9  0x82977654 in android::InputReader::loopOnce (this=0x43da2000) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:283
#10 0x8296cf08 in android::InputReaderThread::threadLoop (this=<optimized out>) at /home/cervantes/hg/mozilla-central/widget/gonk/libui/InputReader.cpp:838
#11 0xa811dd28 in android::Thread::_threadLoop (user=<optimized out>) at frameworks/base/libs/utils/Threads.cpp:770
#12 0xa811e2ea in thread_data_t::trampoline (t=<optimized out>) at frameworks/base/libs/utils/Threads.cpp:127
#13 0xafd11c38 in __thread_entry (func=0xa811e24d <thread_data_t::trampoline(thread_data_t const*)>, arg=0x2bd80, tls=<optimized out>) at bionic/libc/bionic/pthread.c:213
#14 0xafd117ec in pthread_create (thread_out=<optimized out>, attr=0xbe8b14d4, start_routine=0xa811e24d <thread_data_t::trampoline(thread_data_t const*)>, arg=<optimized out>)

-----------------------

The problem originates from program flow enters GeckoInputReaderPolicy::obtainPointerController(), which should never be called in our case (and returns NULL).
We might consider add MOZ_NOTREACHED() here to die early on such cases or add log print indicating something wrong happened.
Comment 1 Cervantes Yu [:cyu] [:cervantes] 2012-04-23 03:55:35 PDT
MOZ_NOT_REACHED() might be too over here because GeckoInputReaderPolicy::obtainPointerController () is in startup code.
Comment 2 Cervantes Yu [:cyu] [:cervantes] 2012-04-24 03:29:13 PDT
Created attachment 617832 [details] [diff] [review]
Add MOZ_NOT_REACHED() in code path that should never be reached
Comment 3 Ryan VanderMeulen [:RyanVM] 2012-05-26 06:39:23 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/9dc532ce5de7
Comment 4 Ryan VanderMeulen [:RyanVM] 2012-05-26 15:27:27 PDT
https://hg.mozilla.org/mozilla-central/rev/9dc532ce5de7

Note You need to log in before you can comment on or make changes to this bug.