PrematureEOFError when launching multiple virtual devices
What's the problem (or question)?
Launching stf (locally), then launching 2 virtual devices. The first one loads up fine, and the second one gets to the boot screen then crashes with the following:
INF/device:support:sub 90008 [emulator-5556] Receiving input from "tcp://127.0.0.1:7114"
INF/device:support:sub 90008 [emulator-5556] Subscribing to permanent channel "*ALL"
FTL/device 90008 [emulator-5556] Setup had an error PrematureEOFError: Premature end of stream, needed 1 more bytes
at Socket.<anonymous> (/Users/chl/.nvm/versions/node/v6.1.0/lib/node_modules/stf/node_modules/adbkit/lib/adb/parser.js:118:32)
at emitNone (events.js:91:20)
at Socket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:926:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
FTL/util:lifecycle 90008 [emulator-5556] Shutting down due to fatal error
What should have happened?
Both boot and are available in STF
Do you have an idea for a solution?
I'm using pretty much the same values for both AVDs, except for the name. This could potentially be an issue?
How can we reproduce the issue?
- Launch STF locally
- Launch a virtual android device, wait for it to boot and connect to STF
- Launch a second virtual android device, wait for it to boot, it will crash.
Help us understand your issue by providing context.
N/A
Please tell us details about your environment.
- Are you using
stf localor a full deployment: - Version used (git hash or
stf -V): - Environment name and version (e.g. Chrome 39, node.js 5.4):
- Operating System and version:
- If there was a problem with a specific device, run
adb devices -land paste the relevant row here:
Using stf local
OSX 10.11
Below are the AVD .ini details:
Test.ini:
avd.ini.encoding=UTF-8
path=/Users/chl/.android/avd/Test.avd
path.rel=avd/Test.avd
target=android-23
config.ini:
avd.ini.encoding=UTF-8
abi.type=x86_64
disk.dataPartition.size=200M
hw.accelerometer=yes
hw.audioInput=yes
hw.battery=yes
hw.camera.back=none
hw.camera.front=none
hw.cpu.arch=x86_64
hw.dPad=no
hw.device.hash2=MD5:6930e145748b87e87d3f40cabd140a41
hw.device.manufacturer=Google
hw.device.name=Nexus 4
hw.gps=yes
hw.gpu.enabled=yes
hw.keyboard=yes
hw.lcd.density=320
hw.mainKeys=no
hw.ramSize=1907
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
image.sysdir.1=system-images/android-23/google_apis/x86_64/
sdcard.size=512M
skin.dynamic=no
skin.name=768x1280
skin.path=768x1280
tag.display=Google APIs
tag.id=google_apis
vm.heapSize=64
Thanks for any help/insight into this.
Thanks for the detailed report. Unfortunately STF does not support virtual devices right now. The PrematureEOFError means that it was looking for something in the output of a command or stream, and couldn't find it. If you run stf with DEBUG=adb:* stf local, you should be able to see the command it attempts to run before that happens. It would be helpful if you could post the context including that debug log, but again, VDs are not really supported right now.
Attached is the debug log. Looks like it just timed out on this run:
EDIT: linking to gist since its a pain in the ass to scroll through. Debug log here: https://gist.github.com/strong-code/bef192fcc2a93952a44124bb9f16416d
After some further testing with launching the AVDs without STF running, it appears they never get past the boot screen if more than 1 is booted. I don't think this is an STF problem but rather something on my end. I'll play around with it more this weekend and report back. Thanks for the debug tip @sorccu!
Turns out it was an issue with my HAXM/AVD memory configuration. HAXM, by default, is installed with 1024 MB of memory allocated and my AVD configurations (again by default) were requesting more than this. To solve it, you can either increase HAXM memory allocation or reduce your AVD's memory to an amount less than or equal to the HAXM allocation.
Happy to say I can confirm STF works fine with multiple AVDs!

Wow that's great! Also, super awesome when people are able to figure things out by themselves and even share their solution :)
I wonder if the screen is visible in STF though?
Sadly it is not - just a black screen. I haven't played around with display configuration too much though since I do not need that feature currently. If anyone has interest in trying to get that to work, let me know and I can mess around with it a bit more. Feel free to close this issue and thanks for the rubber duck debugging!
@strong-code have you tried with connecting virtual devices created in vmware or vbox?
@suvansh-dev I have not. I've only tried using the AVD utility. I can't imagine adding an additional layer of virtualization would help with the black screen issue though.
Hi again, I am trying to connect avd with stf but stf is not displaying my emulator in the devices list, but i have checked in terminal by running command "adb devices" and its showing device there. So what i should to connect stf with avd?
I'm sorry but we have so few contributors that we have to limit the scope of STF somehow - currently that includes not supporting emulators since that would take too much time. I do know that some have managed to find a magic combination of settings that makes certain emulators work, but I'm not aware of the details. Note that it may even depend on your hardware and operating system. Perhaps someone else can share their secrets.
@strong-code @sorccu No black screen issue for me, everything is working fine now :)
That's awesome. If you don't mind, could you share how you set it up? People are always asking so it would be useful.
Ok will share the details soon :)
Hi, For a detailed installation guide I need to know which ABI openstf support as when I tried with connecting an emulator having armeabi-7a ABI then it remains in preparing mode but with those ROM having x86 ABI get easily connected.
#641 (comment) You can find the installation guide to connect the AVD with STF without any black screen issue here: #641