m1k1o / neko

A self hosted virtual browser that runs in docker and uses WebRTC.
https://neko.m1k1o.net/
Apache License 2.0
5.95k stars 449 forks source link

arm-firefox image crashing whenever a tab is trying to play audio on Oracle ARMv8 VPS #308

Closed meelunae closed 2 months ago

meelunae commented 1 year ago

Hello!

When trying to play videos on YouTube using the arm-firefox image on a VPS from Oracle's ARM free tier offering, the Firefox tab consistently crashes; the issue also reproduces when loading SoundCloud pages which made me guess the crash is audio related. I tried booting the image using the flag NEKO_DEBUG and the diagnostic logs seem to hint at a PulseAudio related crash.

ubuntu-neko-1  | 2023-05-15 20:33:57,573 DEBG 'pulseaudio' stdout output:
ubuntu-neko-1  | I: [pulseaudio] client.c: Created 1 "Native client (UNIX socket client)"
ubuntu-neko-1  | I: [pulseaudio] protocol-native.c: Client authenticated anonymously.
ubuntu-neko-1  | 
ubuntu-neko-1  | 2023-05-15 20:33:57,573 DEBG 'pulseaudio' stdout output:
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Protocol version: remote 32, local 32
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: SHM possible: yes
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Negotiated SHM: yes
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Memfd possible: yes
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Negotiated SHM type: shared memfd
ubuntu-neko-1  | 
ubuntu-neko-1  | 2023-05-15 20:33:57,574 DEBG 'pulseaudio' stdout output:
ubuntu-neko-1  | D: [pulseaudio] memblock.c: Using shared memfd memory pool with 1024 slots of size 64.0 KiB each, total size is 64.0 MiB, maximum usable slot size is 65496
ubuntu-neko-1  | D: [pulseaudio] srbchannel.c: SHM block is 65496 bytes, ringbuffer capacity is 2 * 32724 bytes
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Enabling srbchannel...
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Client enabled srbchannel.
ubuntu-neko-1  | 
ubuntu-neko-1  | 2023-05-15 20:33:57,780 DEBG 'pulseaudio' stdout output:
ubuntu-neko-1  | D: [pulseaudio] sink-input.c: Negotiated format: pcm, format.sample_format = "\"s16le\""  format.rate = "48000"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
ubuntu-neko-1  | I: [pulseaudio] sink-input.c: Trying to change sample rate
ubuntu-neko-1  | I: [pulseaudio] resampler.c: Speex appears to be compiled with --enable-fixed-point. Switching to a fixed-point resampler because it should be faster.
ubuntu-neko-1  | D: [pulseaudio] resampler.c: Resampler:
ubuntu-neko-1  | D: [pulseaudio] resampler.c:   rate 48000 -> 44100 (method speex-fixed-1)
ubuntu-neko-1  | D: [pulseaudio] resampler.c:   format s16le -> s16le (intermediate s16le)
ubuntu-neko-1  | D: [pulseaudio] resampler.c:   channels 2 -> 2 (resampling 2)
ubuntu-neko-1  | I: [pulseaudio] speex.c: Choosing speex quality setting 1.
ubuntu-neko-1  | 
ubuntu-neko-1  | 2023-05-15 20:33:57,782 DEBG 'pulseaudio' stdout output:
ubuntu-neko-1  | D: [pulseaudio] memblockq.c: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
ubuntu-neko-1  | D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
ubuntu-neko-1  | I: [pulseaudio] sink-input.c: Created input 0 "AudioStream" on auto_null with sample spec s16le 2ch 48000Hz and channel map front-left,front-right
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     media.name = "AudioStream"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     application.name = "Firefox"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     native-protocol.peer = "UNIX socket client"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     native-protocol.version = "32"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     application.process.id = "15"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     application.process.user = "neko"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     application.process.host = "c530456a9a56"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     application.process.binary = "firefox-esr"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     application.language = "C"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     window.x11.display = ":99.0"
ubuntu-neko-1  | I: [pulseaudio] sink-input.c:     application.process.machine_id = "e8a4b59ac0c40c0bd502574421e3d4ad"
ubuntu-neko-1  | I: [pulseaudio] protocol-native.c: Requested tlength=200.00 ms, minreq=25.00 ms
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Adjust latency mode enabled, configuring sink latency to half of overall latency.
ubuntu-neko-1  | D: [pulseaudio] protocol-native.c: Requested latency=75.00 ms, Received latency=75.00 ms
ubuntu-neko-1  | D: [pulseaudio] memblockq.c: memblockq requested: maxlength=4194304, tlength=24000, base=4, prebuf=19204, minreq=4800 maxrewind=0
ubuntu-neko-1  | D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=4194304, tlength=24000, base=4, prebuf=19204, minreq=4800 maxrewind=0
ubuntu-neko-1  | I: [pulseaudio] protocol-native.c: Final latency 200.00 ms = 75.00 ms + 2*25.00 ms + 75.00 ms
ubuntu-neko-1  | 
ubuntu-neko-1  | 2023-05-15 20:33:57,960 DEBG 'pulseaudio' stdout output:
ubuntu-neko-1  | I: [pulseaudio] sink-input.c: Freeing input 0 "AudioStream"
ubuntu-neko-1  | D: [null-sink] module-null-sink.c: Requested to rewind 1764 bytes.
ubuntu-neko-1  | D: [null-sink] sink.c: Processing rewind...
ubuntu-neko-1  | D: [null-sink] source.c: Processing rewind...
ubuntu-neko-1  | D: [null-sink] module-null-sink.c: Rewound 4 bytes.
ubuntu-neko-1  | 
ubuntu-neko-1  | 2023-05-15 20:34:05,071 DEBG 'neko' stdout output:
ubuntu-neko-1  | 8:34PM DBG request complete (200) module=http req={"agent":"Wget/1.20.1 (linux-gnueabihf)","id":"c530456a9a56/8bbRzBTOOB-000008","method":"GET","proto":"HTTP/1.1","remote":"127.0.0.1:41650","scheme":"http","uri":"http://localhost:8080/health"} res={"bytes":4,"elapsed":0.00772,"status":200,"time":"Mon, 15 May 2023 20:34:05 UTC"}
ubuntu-neko-1  | 
ubuntu-neko-1  | 2023-05-15 20:34:15,137 DEBG 'neko' stdout output:
ubuntu-neko-1  | 8:34PM DBG request complete (200) module=http req={"agent":"Wget/1.20.1 (linux-gnueabihf)","id":"c530456a9a56/8bbRzBTOOB-000009","method":"GET","proto":"HTTP/1.1","remote":"127.0.0.1:59094","scheme":"http","uri":"http://localhost:8080/health"} res={"bytes":4,"elapsed":0.00808,"status":200,"time":"Mon, 15 May 2023 20:34:15 UTC"}
ubuntu-neko-1  | 

My docker-compose is structured as below:

version: "3.4"
services:
  neko:
    image: "m1k1o/neko:arm-firefox"
    restart: "unless-stopped"
    shm_size: "12gb"
    ports:
      - "1993:8080"
      - "52000-52100:52000-52100/udp"
    environment:
      NEKO_SCREEN: 1920x1080@30
      NEKO_PASSWORD: redacted
      NEKO_PASSWORD_ADMIN: redacted
      NEKO_EPR: 52000-52100
      NEKO_ICELITE: 1
      NEKO_VP8: 'false'
      NEKO_VP9: 'false'
      NEKO_H264: 'true'
      NEKO_MAX_FPS: 30
      NEKO_OPUS: 'true'
      NEKO_DEBUG: 1

Is this a known issue? Upon searching in closed issues I've seen that m1k1o tested on an Oracle VPS, but I wasn't able to find any more mentions of this specific type of ARM machine (most issues are focused on Raspberry Pis)

Thank you very much for your support!

lanmuz commented 2 months ago

i tried your compose settings and remove NEKO_OPUS: 'true',and instead image: "m1k1o/neko:arm-firefox" of image: "ghcr.io/m1k1o/neko/arm-chromium:latest" ,i think everything is ok

meelunae commented 2 months ago

@lanmuz thank you very much for testing! I have tried the config provided by you and I get a black screen instead of the browser now. Could you share a dummy docker-compose file that I can use for testing? Maybe I'm missing something else! Thanks!

image
lanmuz commented 2 months ago

sure~ I use this

version: "3.4" services: neko: image: "ghcr.io/m1k1o/neko/arm-chromium:latest" restart: "unless-stopped" shm_size: "2gb" cap_add:

and I installed in oralce arm aarch64 without gpu ubuntu 22.0 system.

lanmuz commented 2 months ago

Snap_2024 04 02_21h30m34s_006 this is my snap of use this setting can watch movies and can receive auido to my laptop and can hear,the video and audio is flash,i think every thing is fine and crashing/exit not happend

meelunae commented 2 months ago

Thank you! I was able to make it work just fine on Chrome with the recommendations you gave me :)