Reidzhang / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Tests failing on L with: This message cannot be recycled because it is still in use. #84

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I run my espresso tests on L Preview I get this consistently:

java.lang.IllegalStateException: This message cannot be recycled because it is 
still in use.
at android.os.Message.recycle(Message.java:261)
at 
com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl.loopUnt
il(UiControllerImpl.java:468)
at 
com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl.loopMai
nThreadUntilIdle(UiControllerImpl.java:337)
at 
com.google.android.apps.common.testing.ui.espresso.ViewInteraction$1.run(ViewInt
eraction.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:738)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5070)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)

Original issue reported on code.google.com by YogurtE...@gmail.com on 27 Jun 2014 at 9:20

GoogleCodeExporter commented 9 years ago
Yep, receiving tons of this as well. This is the relevant code in 
UiControllerImpl.java:

        message.getTarget().dispatchMessage(message);
        message.recycle();

 In the new L developer preview's reference, Message.recycle()'s javadoc reads like this:

"You MUST NOT touch the Message after calling this function because it has 
effectively been freed. It is an error to recycle a message that is currently 
enqueued or that is in the process of being delivered to a Handler."

The question is now, _when_ to recycle messages at all and since the L preview 
is still closed source I also don't know how the Message itself knows if it is 
still in use.

Original comment by m...@thomaskeller.biz on 30 Jun 2014 at 11:58

GoogleCodeExporter commented 9 years ago
Just removing  message.recycle(); seems to fix it... 

Not sure what else that might break, but it doesn't seem to cause problems for 
me. Presumably, it was there for a reason.

Original comment by YogurtE...@gmail.com on 2 Jul 2014 at 2:18

GoogleCodeExporter commented 9 years ago
Will be fixed in the next release.

Original comment by vale...@google.com on 2 Jul 2014 at 5:52

GoogleCodeExporter commented 9 years ago
Any ETA? :) 

Original comment by YogurtE...@gmail.com on 9 Jul 2014 at 4:03

GoogleCodeExporter commented 9 years ago
Stephan is working on it and planning to release a patch this week.

Original comment by vale...@google.com on 14 Jul 2014 at 5:00

GoogleCodeExporter commented 9 years ago
Was this fixed? Some problems?

Original comment by jacek.ma...@gmail.com on 4 Aug 2014 at 11:04

GoogleCodeExporter commented 9 years ago
Any updated ETA? :)

Original comment by YogurtE...@gmail.com on 18 Aug 2014 at 4:28

GoogleCodeExporter commented 9 years ago
This is getting ridiculous. I experience a similar problem from time to time 
("message cannot be recycled") even on an KitKat emulator. Doing a clean build, 
killing the app and / or restarting the emulator do not help in such a case - 
for whatever reason.

C'mon guys, is everybody at Google's Android teams busy working at the Android 
L transition for their respective apps or what is the matter?

Original comment by m...@thomaskeller.biz on 24 Sep 2014 at 2:06

GoogleCodeExporter commented 9 years ago
Long week :) Would love to have working tests again!

Original comment by GoncaloS...@gmail.com on 2 Oct 2014 at 9:08

GoogleCodeExporter commented 9 years ago
I think this issue can be closed because it does not occurs on lollipop

Original comment by jacek.ma...@gmail.com on 20 Oct 2014 at 8:06

GoogleCodeExporter commented 9 years ago
I just saw it on Lollipop yesterday.

Original comment by mbur...@groupon.com on 20 Oct 2014 at 8:12

GoogleCodeExporter commented 9 years ago
Same problem : automation with espresso works on my Tab3 device, not with the 
emulator although Preconditions & VAccelerations seem ok.

Original comment by whatever...@gmail.com on 24 Oct 2014 at 12:43

GoogleCodeExporter commented 9 years ago
Hello team - any ETA on the fix for this? 

Original comment by aol...@tripadvisor.com on 30 Oct 2014 at 5:22

GoogleCodeExporter commented 9 years ago
seems to be still broken!

Original comment by francesc...@gmail.com on 20 Nov 2014 at 11:18

GoogleCodeExporter commented 9 years ago
Definitely still broken 

Original comment by msm...@mst.edu on 21 Nov 2014 at 3:01

GoogleCodeExporter commented 9 years ago
I'm also experiencing this.

Original comment by jedidja...@gmail.com on 24 Nov 2014 at 4:01

GoogleCodeExporter commented 9 years ago
+1 here.  Can we get some word from the team on this?  In particular it would 
be awesome to confirm that you guys are seeing it as well, and also to get a 
read on the viability of the "remove the message.recycle() call" as a 
workaround while we wait for something to drop.  Thanks!

Original comment by g...@thoughtcraft.com on 24 Nov 2014 at 5:41

GoogleCodeExporter commented 9 years ago
"remove the message.recycle() call" is a viable work-around. 

Original comment by YogurtE...@gmail.com on 25 Nov 2014 at 4:52

GoogleCodeExporter commented 9 years ago
@YogurtE... - if you've been using this fix since your message on July 1 and 
all is well, that's good enough for me :) Thanks for responding!

Original comment by jedidja...@gmail.com on 25 Nov 2014 at 1:09

GoogleCodeExporter commented 9 years ago
Is a new version with this fix available?

Thanks.

Original comment by mail.sve...@googlemail.com on 28 Nov 2014 at 4:50

GoogleCodeExporter commented 9 years ago
I'd like to apply the fix to use espresso with lollipop but I can't seem to 
build the android-test-kit with maven, I have installed maven 3.1.1 but it 
complains:

[ERROR] Failed to execute goal on project espresso-tests: Could not resolve 
dependencies for project 
com.google.android.apps.common.testing:espresso-tests:apk:1.1: The following 
artifacts could not be resolved: 
com.google.android.apps.common.testing:testapp:apk:1.1, 
com.google.android.apps.common.testing:testapp:jar:1.1: Could not find artifact 
com.google.android.apps.common.testing:testapp:apk:1.1 in central 
(http://repo.maven.apache.org/maven2) -> [Help 1]

Original comment by joeyz...@gmail.com on 2 Dec 2014 at 3:29

GoogleCodeExporter commented 9 years ago
#21, you might want to apply your fix to Jake Wharton's 
https://github.com/JakeWharton/double-espresso and see if you can build / use 
that instead.

Jake put a big fat warning that he won't accept feature / bugfix pull requests, 
but in case you just want to get it running, you might as well start out with a 
private clone.

Original comment by m...@thomaskeller.biz on 2 Dec 2014 at 3:35

GoogleCodeExporter commented 9 years ago
For what it's worth, as a workaround, I've added a fix and uploaded the 
artifact. I've also integrated fixes from Thomas Guerin. In total, this fixes 
#66, #76, #85 and this one.

https://github.com/freezy/double-espresso

Original comment by phree...@gmail.com on 4 Dec 2014 at 11:31

GoogleCodeExporter commented 9 years ago
+1, many thanks for your efforts! 

Original comment by m...@thomaskeller.biz on 4 Dec 2014 at 11:48

GoogleCodeExporter commented 9 years ago
Fixed in Espresso 2.0

Original comment by vale...@google.com on 20 Dec 2014 at 4:33