Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get video or images out of the box #10

Closed
li-richard opened this issue Sep 7, 2019 · 19 comments · Fixed by #11
Closed

Unable to get video or images out of the box #10

li-richard opened this issue Sep 7, 2019 · 19 comments · Fixed by #11

Comments

@li-richard
Copy link

So I have got the containers and images all up and running, but am unable to see any video or images on the React site.

I thought maybe this was due to the no-window flag used in launch-emulator.sh, but removing this flag ended up causing a Qt error, since it seems like not all the dependencies are installed in docker.

Is the video/image feature supposed to just work out of the box, with -no-window param set?

For reference, the error I am getting with Qt when running without -no-window is:

emulator: INFO: QtLogger.cpp:66: Info: Could not load the Qt platform plugin "xcb" in "/android/sdk/emulator/lib64/qt/plugins" even though it was found. ((null):0, (null))
emulator_1     | 
emulator_1     | 
emulator_1     | emulator: INFO: QtLogger.cpp:66: Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
emulator_1     | 
emulator_1     | Available platform plugins are: xcb.

which seems to be this error therecipe/qt#775.

Any insight is appreciated, thanks!

@pokowaka
Copy link
Collaborator

pokowaka commented Sep 9, 2019

Investigating..

@pokowaka
Copy link
Collaborator

pokowaka commented Sep 9, 2019

Likely an issue with pulse audio. The video module unfortunately requires a working audio driver (out of our control for now). It looks like pulseaudio might not always properly initialize itself, resulting in the termination of the video bridge. I will submit some improvements and some guidance when these types of errors arise.

pokowaka pushed a commit to pokowaka/android-emulator-container-scripts that referenced this issue Sep 9, 2019
The video bridge requires a working pulse audio driver. We now start
pulse audio with a configuration that opens up all access, and add
additional early checks to validate pulse audio configuration.

Updates the documentation with more information how to diagnose WebRTC
failures. This fixes google#10.

Includes fixes for missing adb and python 2 compatibility issues.
This fixes google#9.
pokowaka pushed a commit to pokowaka/android-emulator-container-scripts that referenced this issue Sep 9, 2019
The video bridge requires a working pulse audio driver. We now start
pulse audio with a configuration that opens up all access, and add
additional early checks to validate pulse audio configuration.

Updates the documentation with more information how to diagnose WebRTC
failures. This fixes google#10.

Includes fixes for missing adb and python 2 compatibility issues.
This fixes google#9.
pokowaka pushed a commit to pokowaka/android-emulator-container-scripts that referenced this issue Sep 9, 2019
The video bridge requires a working pulse audio driver. We now start
pulse audio with a configuration that opens up all access, and add
additional early checks to validate pulse audio configuration.

Updates the documentation with more information how to diagnose WebRTC
failures. This fixes google#10.

Includes fixes for missing adb and python 2 compatibility issues.
This fixes google#9.
@li-richard
Copy link
Author

Unfortunately still facing the same issue or similar issue using the latest canary and your update;

Output of docker logs docker_emulator_1 | egrep "pulse:|video:"

$ docker logs docker_emulator_1 | egrep "pulse:|video:"
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
tail: warning: --retry only effective for the initial open
tail: warning: --retry only effective for the initial open
tail: cannot open '/tmp/android-unknown/goldfish_rtc_0' for reading: No such file or directory
statvfs('/android-home/Pixel2.avd/snapshots/default_boot/ram.img') failed: No such file or directory
pulse: Unable to connect to pulse audio, WebRTC will not work.
pc_memory_init: above 4g size: 40000000
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
E0909 17:59:34.975803436      41 socket_utils_common_posix.cc:201] check for SO_REUSEPORT: {"created":"@1568051974.975768216","description":"SO_REUSEPORT unavailable on compiling system","file":"/mnt/tmpfs/src/android/emu-master-dev/external/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc","file_line":169}
Started GRPC server at 0.0.0.0:5556
Pixels are null.
Pixels are null.
Pixels are null.
Pixels are null.
Pixels are null.
tail: '/tmp/android-unknown/goldfish_rtc_0' has appeared;  following new file

From the log, it seems like screenshots are working, but in the browser, no image shows up.

emulator_1     | emulator: INFO: LoggingInterceptor.cpp:69: 1568055052926389, rcvTime: 16, sndTime: 114, UNARY, rcv: 32, snd: 128, /android.emulation.control.EmulatorController/getScreenshot() -> [format { rotation { } }], OK
emulator_1     | emulator: INFO: LoggingInterceptor.cpp:69: 1568055052926747, rcvTime: 21, sndTime: 114, UNARY, rcv: 48, snd: 72, /android.emulation.control.EmulatorController/getLogcat(start: 530) -> [start: 530 next: 530], OK
emulator_1     | emulator: INFO: ScreenCapturer.cpp:67: Screenshot from renderer
emulator_1     | Pixels are null.

After removing -no-window flag:

$ docker logs docker_emulator_1 | egrep "pulse:|video:"
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
tail: warning: --retry only effective for the initial open
tail: warning: --retry only effective for the initial open
tail: cannot open '/tmp/android-unknown/goldfish_rtc_0' for reading: No such file or directory
statvfs('/android-home/Pixel2.avd/snapshots/default_boot/ram.img') failed: No such file or directory
pulse: Unable to connect to pulse audio, WebRTC will not work.
Warning: could not connect to display  ((null):0, (null))
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.
 ((null):0, (null))

@741g
Copy link
Contributor

741g commented Sep 9, 2019

Interesting; let's also try with modifying the Dockerfile to launch emulator-headless. It's possible a Qt dependency is leaking through.

@741g 741g reopened this Sep 9, 2019
@741g
Copy link
Contributor

741g commented Sep 9, 2019

tail: cannot open '/tmp/android-unknown/goldfish_rtc_0' for reading: No such file or directory

this could also be related

In the web interface itself, can you also try using the PNG fallback?

@741g
Copy link
Contributor

741g commented Sep 9, 2019

The reason youre seeing the error without -no-window is that Qt UI gets loaded, which in turn requires a bunch of dependencies not specified in the dockerfile.

@li-richard
Copy link
Author

Yeah, I figured that was the issue without -no-window, just wanted to check that Pixels are null wasn't because it was running headless.

Regarding using PNG fallback, the logs look identical to just using PNG:

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
tail: warning: --retry only effective for the initial open
tail: warning: --retry only effective for the initial open
tail: cannot open '/tmp/android-unknown/goldfish_rtc_0' for reading: No such file or directory
statvfs('/android-home/Pixel2.avd/snapshots/default_boot/ram.img') failed: No such file or directory
pulse: Unable to connect to pulse audio, WebRTC will not work.
pc_memory_init: above 4g size: 40000000
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
E0909 20:17:57.144923948      42 socket_utils_common_posix.cc:201] check for SO_REUSEPORT: {"created":"@1568060277.144906027","description":"SO_REUSEPORT unavailable on compiling system","file":"/mnt/tmpfs/src/android/emu-master-dev/external/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc","file_line":169}
Started GRPC server at 0.0.0.0:5556
Pixels are null.
tail: '/tmp/android-unknown/goldfish_rtc_0' has appeared;  following new file
Pixels are null.
Pixels are null.
Pixels are null.

Something weird I noticed; on fresh startup of the containers, if I have the web view open already, I will get the PNG of the android boot screen, but no further images afterwards.

Running with emulator-headless , the logs are the same.

@pokowaka
Copy link
Collaborator

pokowaka commented Sep 10, 2019

tail: cannot open '/tmp/android-unknown/goldfish_rtc_0' for reading: No such file or directory

this could also be related

The reason you are seeing this is because the log file will be created when the video bridge actually starts, we initially are waiting for the file to be created (hence the --retry flag). Later on we should see this on the log:

tail: '/tmp/android-unknown/goldfish_rtc_0' has appeared; following new file

@li-richard did you re-run the emu-docker script to create a new emulator container? With the new changes I expect to see something along the following on the logs:

pulse: (   0.030|   0.000) D: [pulseaudio] protocol-native.c: SHM possible: yes
pulse: (   0.030|   0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: yes
... <truncated>...
pulse: (   0.031|   0.000) I: [pulseaudio] client.c: Freed 0 "pactl"
... <truncated>...
pulse: (   1.325|   1.293) I: [pulseaudio] client.c: Created 1 "Native client (UNIX socket client)"
... <truncated>...
pulse: (   3.955|   0.215) I: [pulseaudio] client.c: Created 2 "Native client (UNIX socket client)"

The WebRTC module will not work if you see this line:

pulse: Unable to connect to pulse audio, WebRTC will not work.

It is normal for Pixels to be null before the emulator has completed booting. See following log snippet:

docker logs docker_emulator_1 2>&1

...<truncated>...
emulator: VERBOSE: EmulatorService.cpp:362: Screenshot: 0x0, fmt: 0 in: 0 ms
Pixels are null.
emulator: VERBOSE: EmulatorService.cpp:154: getLogcat: offset: 2583943
[    1.370802] scsi host0: ata_piix <--- We are still bringing up the kernel
...<truncated>...

Pixels will become available later in the boot sequence. Usually by the time logcat becomes active, pixels are available.

I've filled two emulator bugs to track improvements we can make:

@li-richard could you please try re-running with the latest changes? i.e.

python setup.py develop; emu-docker create <emu-zip> <img-zip>; docker-compose -f js/docker/docker-compose.yaml build;

@li-richard
Copy link
Author

Ran the commands you specified @pokowaka with the latest changes. Continuing to see the screenshot of the android boot screen flash once or twice, then no further images follow.

From what you said about pixels becoming available later in the boot sequence, it seems like the root cause of not being able to get images might be due to the emulator crashing on startup?

Here's the output of docker logs docker_emulator_1 | egrep "pulse:|video:":

$ docker logs docker_emulator_1 | egrep "pulse:|video:"
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
tail: warning: --retry only effective for the initial open
tail: warning: --retry only effective for the initial open
tail: cannot open '/tmp/android-unknown/goldfish_rtc_0' for reading: No such file or directory
statvfs('/android-home/Pixel2.avd/snapshots/default_boot/ram.img') failed: No such file or directory
pulse: Unable to connect to pulse audio, WebRTC will not work.
pc_memory_init: above 4g size: 40000000
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
E0910 19:14:49.567190420      41 socket_utils_common_posix.cc:201] check for SO_REUSEPORT: {"created":"@1568142889.567170526","description":"SO_REUSEPORT unavailable on compiling system","file":"/mnt/tmpfs/src/android/emu-master-dev/external/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc","file_line":169}
Started GRPC server at 0.0.0.0:5556
tail: '/tmp/android-unknown/goldfish_rtc_0' has appeared;  following new file
Pixels are null.
Pixels are null.
video: (GoldfishBridge.cpp:77): Able to map first 4 bytes of: videmulator6554
video: (EmulatorConnection.cpp:51): Spawned a child under: 52
video: (GoldfishBridge.cpp:83): Finished, status: 0
video: (EmulatorConnection.cpp:62): Listening on: 127.0.0.1:5557
video: (EmulatorConnection.cpp:79): New switchboard registered for incoming emulator.
video: (Switchboard.cpp:87): Received: {"from":"e10e6b69-e286-4cf8-af09-ccce5c3d3547","msg":"{\"start\":\"e10e6b69-e286-4cf8-af09-ccce5c3d3547\"}"}
video: (Switchboard.cpp:175): Sending {"msg":"{\"start\":{}}","topic":"e10e6b69-e286-4cf8-af09-ccce5c3d3547"}
video: (audio_processing_impl.cc:395): Capture analyzer activated: 0
video: Capture post processor activated: 0
video: Render pre processor activated: 0
video: (webrtcvideoengine.cc:463): WebRtcVideoEngine::WebRtcVideoEngine()
video: (webrtcvoiceengine.cc:199): WebRtcVoiceEngine::WebRtcVoiceEngine
video: (webrtcvoiceengine.cc:222): WebRtcVoiceEngine::Init
video: (webrtcvoiceengine.cc:229): Supported send codecs in order of preference:
video: (webrtcvoiceengine.cc:232): opus/48000/2 { minptime=10 useinbandfec=1 } (111)
video: (webrtcvoiceengine.cc:232): ISAC/16000/1 (103)
video: (webrtcvoiceengine.cc:232): ISAC/32000/1 (104)
video: (webrtcvoiceengine.cc:232): G722/8000/1 (9)
video: (webrtcvoiceengine.cc:232): ILBC/8000/1 (102)
video: (webrtcvoiceengine.cc:232): PCMU/8000/1 (0)
video: (webrtcvoiceengine.cc:232): PCMA/8000/1 (8)
video: (webrtcvoiceengine.cc:232): CN/32000/1 (106)
video: (webrtcvoiceengine.cc:232): CN/16000/1 (105)
video: (webrtcvoiceengine.cc:232): CN/8000/1 (13)
video: (webrtcvoiceengine.cc:232): telephone-event/48000/1 (110)
video: (webrtcvoiceengine.cc:232): telephone-event/32000/1 (112)
video: (webrtcvoiceengine.cc:232): telephone-event/16000/1 (113)
video: (webrtcvoiceengine.cc:232): telephone-event/8000/1 (126)
video: (webrtcvoiceengine.cc:235): Supported recv codecs in order of preference:
Pixels are null.
video: (webrtcvoiceengine.cc:238): opus/48000/2 { minptime=10 useinbandfec=1 } (111)
video: (webrtcvoiceengine.cc:238): ISAC/16000/1 (103)
video: (webrtcvoiceengine.cc:238): ISAC/32000/1 (104)
Pixels are null.
video: (webrtcvoiceengine.cc:238): G722/8000/1 (9)
Pixels are null.
video: (webrtcvoiceengine.cc:238): ILBC/8000/1 (102)
video: (webrtcvoiceengine.cc:238): PCMU/8000/1 (0)
video: (webrtcvoiceengine.cc:238): PCMA/8000/1 (8)
video: (webrtcvoiceengine.cc:238): CN/32000/1 (106)
video: (webrtcvoiceengine.cc:238): CN/16000/1 (105)
video: (webrtcvoiceengine.cc:238): CN/8000/1 (13)
video: (webrtcvoiceengine.cc:238): telephone-event/48000/1 (110)
video: (webrtcvoiceengine.cc:238): telephone-event/32000/1 (112)
Pixels are null.
video: (webrtcvoiceengine.cc:238): telephone-event/16000/1 (113)
video: (webrtcvoiceengine.cc:238): telephone-event/8000/1 (126)
video: (audio_device_impl.cc:75): Create
video: (audio_device_impl.cc:82): CreateForTest
video: (audio_device_buffer.cc:61): AudioDeviceBuffer::ctor
video: (audio_device_impl.cc:125): AudioDeviceModuleImpl
Pixels are null.
video: (audio_device_impl.cc:129): CheckPlatform
Pixels are null.
video: (audio_device_impl.cc:140): current platform is Linux
Pixels are null.
video: (audio_device_impl.cc:159): CreatePlatformSpecificObjects
video: (audio_device_impl.cc:938): PlatformAudioLayer
Pixels are null.
Pixels are null.
video: (audio_device_impl.cc:269): PulseAudio support is enabled.
video: (audio_mixer_manager_pulse_linux.cc:56): AudioMixerManagerLinuxPulse created
Pixels are null.
video: (audio_device_pulse_linux.cc:82): AudioDeviceLinuxPulse created
video: (audio_device_impl.cc:274): Linux PulseAudio APIs will be utilized
Pixels are null.
video: (audio_device_impl.cc:314): AttachAudioBuffer
Pixels are null.
video: (audio_device_buffer.cc:178): SetRecordingSampleRate(0)
video: (audio_device_buffer.cc:184): SetPlayoutSampleRate(0)
Pixels are null.
Pixels are null.
video: (audio_device_buffer.cc:198): SetRecordingChannels(0)
Pixels are null.
video: (audio_device_buffer.cc:204): SetPlayoutChannels(0)
video: (audio_device_impl.cc:334): Init
Pixels are null.
video: (audio_device_pulse_linux.cc:1604): failed to connect context, error=-1
video: (audio_device_pulse_linux.cc:145): failed to initialize PulseAudio
video: (audio_device_impl.cc:343): Audio device initialization failed.
Pixels are null.
video: (audio_device_impl.cc:334): Init
video: (audio_device[    2.961799] binder: 1155:1155 transaction failed 29189, size 0-0
Pixels are null.
...
Pixels are null.

Even after logcat becomes active, I'm still getting Pixels are null.

emulator_1     | emulator: INFO: LoggingInterceptor.cpp:69: 1568142941371071, rcvTime: 16, sndTime: 104, UNARY, rcv: 32, snd: 128, /android.emulation.control.EmulatorController/getScreenshot() -> [format { rotation { } }], OK
emulator_1     | Pixels are null.
emulator_1     | emulator: INFO: ScreenCapturer.cpp:67: Screenshot from renderer
emulator_1     | emulator: INFO: LoggingInterceptor.cpp:69: 1568142941571056, rcvTime: 16, sndTime: 82, UNARY, rcv: 32, snd: 128, /android.emulation.control.EmulatorController/getScreenshot() -> [format { rotation { } }], OK
emulator_1     | Pixels are null.
emulator_1     | Pixels are null.
emulator_1     | emulator: INFO: ScreenCapturer.cpp:67: Screenshot from renderer
emulator_1     | emulator: INFO: LoggingInterceptor.cpp:69: 1568142941771080, rcvTime: 16, sndTime: 98, UNARY, rcv: 32, snd: 128, /android.emulation.control.EmulatorController/getScreenshot() -> [format { rotation { } }], OK
emulator_1     | emulator: INFO: ScreenCapturer.cpp:67: Screenshot from renderer

@li-richard
Copy link
Author

logs.txt
Attaching the complete logs of docker logs docker_emulator_1

@pokowaka
Copy link
Collaborator

pokowaka commented Sep 10, 2019

I noticed:

pulse: Unable to connect to pulse audio, WebRTC will not work.

On the logs. This means pulse audio is not properly initialized. The video bridge cannot launch.

We are also running into some serious kernel issues (this should not be happening):

[    1.784377] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G    B        3.10.0+ #1
[    1.785189] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
[    1.786619]  0000000000001000 ffff88012d437be8 ffffffff8153c1c3 ffff88012d437c08
[    1.787587]  ffffffff810b4070 0000000000000000 ffffea0004b70a00 ffff88012d437c38
[    1.788539]  ffffffff810b4133 ffffea0004b70000 000000000000000c 0000000000fd2000
[    1.789442] Call Trace:
[    1.789776]  [<ffffffff8153c1c3>] dump_stack+0x19/0x1b
[    1.790405]  [<ffffffff810b4070>] bad_page+0xcb/0xe5
[    1.790987]  [<ffffffff810b4133>] free_pages_prepare+0xa9/0x118
[    1.791708]  [<ffffffff810b59ac>] __free_pages+0x2a/0x3e
[    1.792341]  [<ffffffff810066fe>] dma_generic_alloc_coherent+0xd7/0x115
[    1.793126]  [<ffffffff8101f7d2>] x86_swiotlb_alloc_coherent+0x1c/0x3b
[    1.793890]  [<ffffffff8121749e>] goldfish_fb_probe+0x288/0x3fa
[    1.794612]  [<ffffffff8129916e>] platform_drv_probe+0x37/0x63
[    1.795308]  [<ffffffff8129758e>] ? driver_sysfs_add+0x6b/0x90
[    1.796000]  [<ffffffff81297aa4>] driver_probe_device+0x96/0x1cb
[    1.796724]  [<ffffffff81297c6a>] __driver_attach+0x59/0x7c
[    1.797389]  [<ffffffff81297c11>] ? __device_attach+0x38/0x38
[    1.798068]  [<ffffffff81296cf5>] bus_for_each_dev+0x82/0x87
[    1.798744]  [<ffffffff8129764d>] driver_attach+0x19/0x1b
[    1.799371]  [<ffffffff812972ce>] bus_add_driver+0xff/0x1fc
[    1.800056]  [<ffffffff81298140>] driver_register+0x87/0xf6
[    1.800711]  [<ffffffff81ae666b>] ? genericbl_driver_init+0x12/0x12
[    1.801505]  [<ffffffff81298f51>] platform_driver_register+0x41/0x43
[    1.802252]  [<ffffffff81ae667b>] goldfish_fb_driver_init+0x10/0x12
[    1.803002]  [<ffffffff81000263>] do_one_initcall+0x7b/0x113
[    1.803676]  [<ffffffff81abadbe>] kernel_init_freeable+0x115/0x198
[    1.804406]  [<ffffffff8152f9cb>] ? rest_init+0x7f/0x7f
[    1.805022]  [<ffffffff8152f9d4>] kernel_init+0x9/0xd1
[    1.805639]  [<ffffffff81541aec>] ret_from_fork+0x7c/0xb0
[    1.806280]  [<ffffffff8152f9cb>] ? rest_init+0x7f/0x7f

I do see on the logs that screenshots fail to produce results:

emulator: INFO: LoggingInterceptor.cpp:69: 1568142895842029, rcvTime: 18, sndTime: 566, UNARY, rcv: 32, snd: 29039, /android.emulation.control.EmulatorController/getScreenshot() -> [format { rotation { } } width: 1080 height: 1920 image: "\211PNG\r\n\032\n\00...], OK <-- Screenshot works fine.
emulator: INFO: ScreenCapturer.cpp:67: Screenshot from renderer 
emulator: INFO: LoggingInterceptor.cpp:69: 1568142896042371, rcvTime: 20, sndTime: 104, UNARY, rcv: 32, snd: 128, /android.emulation.control.EmulatorController/getScreenshot() -> [format { rotation { } }], OK <-- NOTHING?

Could you perhaps share the CPU/OS and docker version you using?

lscpu;uname -a;cat /etc/issue;docker -v

Are you running in a nested virtualization environment?

That way I might be able to reproduce it locally to get a better understanding of what is going on.

@li-richard
Copy link
Author

Not running in a nested virtual environment.

Other information:

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    2
Core(s) per socket:    8
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
Stepping:              1
CPU MHz:               1210.535
BogoMIPS:              4190.32
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              20480K
NUMA node0 CPU(s):     0-15
$ uname -a
Linux rili-ld1 3.10.0-514.36.5.el7.x86_64 #1 SMP Thu Dec 28 21:42:18 EST 2017 x86_64 x86_64 x86_64 GNU/Linux
$ docker -v
Docker version 19.03.2, build 6a30dfc

@pokowaka
Copy link
Collaborator

It looks like you are using redhat, which version are you using?

@li-richard
Copy link
Author

$ cat /etc/redhat-release
Red Hat Enterprise Linux Workstation release 7.3 (Maipo)

@pokowaka
Copy link
Collaborator

Thank you for your patience!

I've managed to partially reproduce what happens. It looks like it is possible that the container with the emulator is not launched from a clean slate. This can happen when the emulator crashes (possible due to the kernel issues you are seeing). This can cause multiple issues:

  • Pulse Audio fails to initialize properly, (maybe the domain socket is lingering), causing video bridge problems
  • The emulator believes it is already running, causing direct exits (you are not seeing this, but I am).

I'm investigating what we can do to unblock you.

On a side note, it appears that some older api levels (19 <) have kernel issues when running within Docker. It is likely that those images will not properly run.

@li-richard
Copy link
Author

li-richard commented Sep 11, 2019

Based off your comments, I cleaned out all the old images and containers, and rebuilt everything from scratch, and was able to get video as well as screenshots working.

However, I was unable to get past the boot screen, and there is no further logcat output besides

emulator_1     | emulator: INFO: LoggingInterceptor.cpp:69: 1568234419620598, rcvTime: 22, sndTime: 104, UNARY, rcv: 48, snd: 72, /android.emulation.control.EmulatorController/getLogcat(start: 316184) -> [start: 316184 next: 316184], OK
emulator_1     | [ 1023.926957] healthd: battery l=100 v=0 t=0.0 h=2 st=2 chg=a

and it looks like I'm still getting the kernel problems mentioned above.

Also for reference, I am running API 22 on emulator v29.1.13 canary. Will retry with higher API level to see if I can reproduce there.

EDIT: I was able to get it working with API 28, emu v29.1.13 canary

pokowaka pushed a commit to pokowaka/android-emulator-container-scripts that referenced this issue Sep 11, 2019
It is possible that the emulator container has data left around. This
can cause trouble where:

- PulseAudio fails to initialize, disabling the video bridge
- Dangling snapshot locks, disabling emulator launch.

Usually this is due to unexpected exits of the emulator executable.

This also includes some cleanup of the Dockerfile to introduce multiple
layers. This makes it faster to rebuild the containers.

Updates the documentation to explain why pre-O images will not work.

Fixes issue google#10
@pokowaka
Copy link
Collaborator

Thank you! I've verified that we cannot launch images before O due to kernel issues. We are tracking this in https://issuetracker.google.com/issues/140881613.

@pokowaka
Copy link
Collaborator

Let me know if you are unblocked and we can close the issue.

@li-richard
Copy link
Author

Feel free to close. We actually run our test suite on API 22, but I'll follow the issuetracker for updates regarding that.

Thanks for your help in resolving this!

pokowaka pushed a commit to pokowaka/android-emulator-container-scripts that referenced this issue Sep 13, 2019
- Fixes a bug where we could not launch older API levels
- Setup a default formatter (black)
- Enable GPU detection, if docker exposes your gpu we will use it
- Fix Docker file order to improve caching

Bugs: https://buganizer.corp.google.com/issues/140773032
Fixes: google#10
pokowaka pushed a commit to pokowaka/android-emulator-container-scripts that referenced this issue Sep 14, 2019
- Fixes a bug where we could not launch older API levels
- Setup a default formatter (black)
- Enable GPU detection, if docker exposes your gpu we will use it
- Fix Docker file order to improve caching

Bugs: https://buganizer.corp.google.com/issues/140773032
Fixes: google#10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants