registerReceiver - not registering?

353 views
Skip to first unread message

Vairavan

unread,
Dec 9, 2010, 7:24:54 PM12/9/10
to android-platform
Hi,

I have the following scenario where in there is a leak of
IntentReceiver while registering and the eventual request to
unregister fails.
Is this a known issue?

Leak in android.server.ServerThread

01-01 02:10:52.655 168 183 E ActivityThread: Service
com.android.internal.service.wallpaper.ImageWallpaper has leaked
IntentReceiver android.service.wallpaper.WallpaperService$Engine
$1@469de4d8 that was originally registered here. Are you missing a
call to unregisterReceiver()?
01-01 02:10:52.655 168 183 E ActivityThread:
android.app.IntentReceiverLeaked: Service
com.android.internal.service.wallpaper.ImageWallpaper has leaked
IntentReceiver android.service.wallpaper.WallpaperService$Engine
$1@469de4d8 that was originally registered here. Are you missing a
call to unregisterReceiver()?
01-01 02:10:52.655 168 183 E ActivityThread: at
android.app.ActivityThread$PackageInfo
$ReceiverDispatcher.<init>(ActivityThread.java:944)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.app.ActivityThread
$PackageInfo.getReceiverDispatcher(ActivityThread.java:739)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:791)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.app.ContextImpl.registerReceiver(ContextImpl.java:778)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.app.ContextImpl.registerReceiver(ContextImpl.java:772)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.content.ContextWrapper.registerReceiver(ContextWrapper.java:
318)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.service.wallpaper.WallpaperService
$Engine.attach(WallpaperService.java:601)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.service.wallpaper.WallpaperService
$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:821)
01-01 02:10:52.655 168 183 E ActivityThread: at
com.android.internal.os.HandlerCaller
$MyHandler.handleMessage(HandlerCaller.java:61)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.os.Handler.dispatchMessage(Handler.java:99)
01-01 02:10:52.655 168 183 E ActivityThread: at
android.os.Looper.loop(Looper.java:123)
01-01 02:10:52.655 168 183 E ActivityThread: at
com.android.server.WindowManagerService
$PolicyThread.run(WindowManagerService.java:606)

Unregister failure in WindowManagerPolicy

01-01 02:10:52.635 168 235 E AndroidRuntime: *** FATAL EXCEPTION
IN SYSTEM PROCESS: WindowManagerPolicy
01-01 02:10:52.635 168 235 E AndroidRuntime:
java.lang.IllegalArgumentException: Receiver not registered:
android.service.wallpaper.WallpaperService$Engine$1@469de4d8
01-01 02:10:52.635 168 235 E AndroidRuntime: at
android.app.ActivityThread
$PackageInfo.forgetReceiverDispatcher(ActivityThread.java:798)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
android.app.ContextImpl.unregisterReceiver(ContextImpl.java:814)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:
331)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
android.service.wallpaper.WallpaperService
$Engine.detach(WallpaperService.java:736)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
android.service.wallpaper.WallpaperService
$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:827)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
com.android.internal.os.HandlerCaller
$MyHandler.handleMessage(HandlerCaller.java:61)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
android.os.Handler.dispatchMessage(Handler.java:99)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
android.os.Looper.loop(Looper.java:123)
01-01 02:10:52.635 168 235 E AndroidRuntime: at
com.android.server.WindowManagerService
$PolicyThread.run(WindowManagerService.java:606)

Dianne Hackborn

unread,
Dec 12, 2010, 9:01:43 PM12/12/10
to android-...@googlegroups.com
The leak means you didn't unregister before your hosting object was destroyed.  You get the crash later if you try to unregister, because at that point the object is no longer valid.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Reply all
Reply to author
Forward
0 new messages