Repeated use of UDPSocket without calling close() end up restarting Gaia

RESOLVED WONTFIX

Status

Firefox OS
Stability
RESOLVED WONTFIX
3 years ago
9 months ago

People

(Reporter: sole, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

I found out that if I create and use UDPSockets continuously without calling close() on them after sending a message, Gaia eventually crashes.

Receiving messages seems fine.

I made a test app that first sets up a UDPSocket to listen for connections and then floods itself with UDPSocket messages. After a while it crashes.
Here's the app:
https://github.com/sole/UDPCrash

It's "certified" so it can have access to all these features. You'll need a rooted phone to install it.

Here's a video: https://youtu.be/3olJNwlSuJg

The log right and after it crashes:

c6d161/js/app.js:87:4)
I/UDPCrash(21851): Content JS LOG: ping 10.246.37.187 606
I/UDPCrash(21851):     at ping (app://5fed0b90-dde4-11e4-94da-250544c6d161/js/app.js:87:4)
I/UDPCrash(21851): Content JS LOG: ping 10.246.37.187 607
I/UDPCrash(21851):     at ping (app://5fed0b90-dde4-11e4-94da-250544c6d161/js/app.js:87:4)
I/Gecko   (21851): [Child 21851] WARNING: pipe error (3): Connection reset by peer: file ../../../gecko/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 456
I/Gecko   (21851):
I/Gecko   (21851): ###!!! [Child][MessageChannel] Error: Channel error: cannot send/recv
I/Gecko   (21851):
I/ServiceManager(  190): service 'media.audio_flinger' died
I/ServiceManager(  190): service 'media.player' died
I/ServiceManager(  190): service 'media.camera' died
I/ServiceManager(  190): service 'media.audio_policy' died
I/mediaserver(22981): ServiceManager: 0xb8874448
I/AudioFlinger(22981): Using default 3000 mSec as standby time.
E/MediaPlayerFactory(22981): calling dlopen on FACTORY_LIB
E/MediaPlayerFactory(22981): calling dlsym on pFactoryLib for FACTORY_CREATE_FN
E/MediaPlayerFactory(22981): registering DASH Player factory...
I/CameraService(22981): CameraService started (pid=22981)
D/mm-camera-intf(22981): index = 0 flag = 3 mount_angle = 270 facing = 0
D/mm-camera-intf(22981): index = 1 flag = 103 mount_angle = 270 facing = 1
I/CameraService(22981): Loaded "QCamera Module" camera module
I/AudioPolicyManagerBase(22981): loadAudioPolicyConfig() loaded /system/etc/audio_policy.conf
D/audio_hw_primary(22981): adev_open: enter
E/audio_route(22981): Control 'RX2 MIX2 INP2' doesn't exist - skipping
E/audio_route(22981): Control 'RX1 MIX2 INP2' doesn't exist - skipping
E/audio_route(22981): Control 'MI2S_DL_HL Switch' doesn't exist - skipping
E/audio_route(22981): Control 'MI2S_DL_HL Switch' doesn't exist - skipping
D/msm8974_platform(22981): platform_init: Opened sound card:0
D/ACDB-LOADER(22981): ACDB -> Load file: /etc/acdbdata/QRD/QRD_Bluetooth_cal.acdb
D/ACDB-LOADER(22981): ACDB -> Load file: /etc/acdbdata/QRD/QRD_General_cal.acdb
D/ACDB-LOADER(22981): ACDB -> Load file: /etc/acdbdata/QRD/QRD_Global_cal.acdb
D/ACDB-LOADER(22981): ACDB -> Load file: /etc/acdbdata/QRD/QRD_Handset_cal.acdb
D/ACDB-LOADER(22981): ACDB -> Load file: /etc/acdbdata/QRD/QRD_Hdmi_cal.acdb
D/ACDB-LOADER(22981): ACDB -> Load file: /etc/acdbdata/QRD/QRD_Headset_cal.acdb
D/ACDB-LOADER(22981): ACDB -> Load file: /etc/acdbdata/QRD/QRD_Speaker_cal.acdb
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_INITIALIZE_V2
D/ACDB-LOADER(22981): ACDB -> ACPH INIT
D/        (22981): [ACPH]->Online service registered with ACPH
D/        (22981): [ACPH]->ACPH init success
D/ACDB-LOADER(22981): ACDB -> RTAC INIT
D/        (22981): [ACPH]->DSP RTC service registered with ACPH
D/ACDB-LOADER(22981): ACDB -> ADIE RTAC INIT
D/        (22981): [ACPH]->ADIE RTC service registered with ACPH
D/ACDB-LOADER(22981): No existing ION info in ACDB driver
D/ACDB-LOADER(22981): ACDB -> ION_IOC_ALLOC
D/ACDB-LOADER(22981): ACDB -> ION_IOC_SHARE
D/ACDB-LOADER(22981): ACDB -> MMAP ADDR
D/ACDB-LOADER(22981): ACDB -> register MEM to ACDB driver: 0xb5cfb000
D/ACDB-LOADER(22981): ACDB -> send_asm_topology
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
D/ACDB-LOADER(22981): ACDB -> send_adm_custom_topology
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_AUDIO_COPP_TOPOLOGIES
D/ACDB-LOADER(22981): ACDB -> AUDIO_SET_ADM_CUSTOM_TOPOLOGY
D/ACDB-LOADER(22981): ACDB -> send_asm_custom_topology
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_AUDIO_POPP_TOPOLOGIES
D/        (22981): ACDBFILE_MGR: Property for the pid 00012E48 not found
D/        (22981): ACDB_COMMAND: Failed to fetch the property info for pid 00012E48
E/ACDB-LOADER(22981): Error: ACDB get asm topologies returned = -18
D/ACDB-LOADER(22981): ACDB -> AUDIO_SET_ASM_CUSTOM_TOPOLOGY
D/ACDB-LOADER(22981): send mbhc data
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_ANC_SETTING
D/        (22981): Invalid AV file. It doesnt contain LUT for tblid 0000000A
D/        (22981): Failed to fetch the lookup information of the device 0000001A
E/ACDB-LOADER(22981): Error: ACDB ANC returned = -1
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_ANC_SETTING
D/        (22981): Invalid AV file. It doesnt contain LUT for tblid 0000000A
D/        (22981): Failed to fetch the lookup information of the device 0000001B
E/ACDB-LOADER(22981): Error: ACDB ANC returned = -1
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_ANC_SETTING
D/        (22981): Invalid AV file. It doesnt contain LUT for tblid 0000000A
D/        (22981): Failed to fetch the lookup information of the device 0000001C
E/ACDB-LOADER(22981): Error: ACDB ANC returned = -1
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_ANC_SETTING
D/        (22981): Invalid AV file. It doesnt contain LUT for tblid 0000000A
D/        (22981): Failed to fetch the lookup information of the device 0000001D
E/ACDB-LOADER(22981): Error: ACDB ANC returned = -1
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_ANC_SETTING
D/        (22981): Invalid AV file. It doesnt contain LUT for tblid 0000000A
D/        (22981): Failed to fetch the lookup information of the device 0000001E
E/ACDB-LOADER(22981): Error: ACDB ANC returned = -1
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_ANC_SETTING
D/        (22981): Invalid AV file. It doesnt contain LUT for tblid 0000000A
D/        (22981): Failed to fetch the lookup information of the device 0000001F
E/ACDB-LOADER(22981): Error: ACDB ANC returned = -1
D/ACDB-LOADER(22981): ACDB -> ACDB_CMD_GET_ANC_SETTING
D/        (22981): Invalid AV file. It doesnt contain LUT for tblid 0000000A
D/        (22981): Failed to fetch the lookup information of the device 00000067
E/ACDB-LOADER(22981): Error: ACDB ANC returned = -1
D/ACDB-LOADER(22981): ACDB -> init done!
D/platform_parser(22981): platform_info_init: Failed to open /system/etc/platform_info.xml, using defaults.
D/audio_hw_ssr(22981): audio_extn_ssr_update_enabled: surround sound recording is not supported
I/AudioFlinger(22981): loadHwModule() Loaded primary audio interface from QCOM Audio HAL (audio) handle 1
I/AudioFlinger(22981): HAL output buffer size 960 frames, normal mix buffer size 960 frames
I/AudioMixer(22981): found effect "Multichannel Downmix To Stereo" from The Android Open Source Project
I/AudioFlinger(22981): Using module 1 has the primary audio interface
I/AudioFlinger(22981): AudioFlinger's thread 0xb5cac008 ready to run
W/AudioFlinger(22981): Thread AudioOut_2 cannot connect to the power manager service
D/audio_hw_primary(22981): out_set_parameters: enter: usecase(0: deep-buffer-playback) kvpairs: routing=2
D/audio_hw_extn(22981): audio_extn_set_anc_parameters: anc_enabled:0
W/AudioFlinger(22981): Thread AudioOut_2 cannot connect to the power manager service
W/AudioFlinger(22981): Thread AudioOut_2 cannot connect to the power manager service
E/AudioFlinger(22981): no wake lock to update!
I/audio_a2dp_hw(22981): adev_open:  adev_open in A2dp_hw module
I/AudioFlinger(22981): loadHwModule() Loaded a2dp audio interface from A2DP Audio HW HAL (audio) handle 3
I/AudioFlinger(22981): loadHwModule() Loaded usb audio interface from USB audio HW HAL (audio) handle 4
I/r_submix(22981): adev_open(name=audio_hw_if)
I/r_submix(22981): adev_init_check()
I/AudioFlinger(22981): loadHwModule() Loaded r_submix audio interface from Wifi Display audio HAL (audio) handle 5
I/AudioPolicyService(22981): Loaded audio policy from LEGACY Audio Policy HAL (audio_policy)
W/        (22980): could not open framebuffer
I/Gecko   (22996): [22996] WARNING: Tried to RegisterCallback without an AtExitManager: file ../../../gecko/ipc/chromium/src/base/at_exit.cc, line 40
I/qdhwcomposer(22980): Initializing Qualcomm Hardware Composer
I/qdhwcomposer(22980): MDP version: 304
D/qdhwcomposer(22980): hwc_getDisplayAttributes disp = 0, width = 480
D/qdhwcomposer(22980): hwc_getDisplayAttributes disp = 0, height = 854
E/qdhwcomposer(22980): Unknown display attribute 0
I/QCOM PowerHAL(22980): QCOM power HAL initing.
D/qdhwcomposer(22980): hwc_blank: Unblanking display: 0
D/qdhwcomposer(22980): hwc_blank: Done unblanking display: 0
I/        (22980): Starting bootanimation with (1) format framebuffer
W/Gonk    (22980): Could not open boot animation
I/GeckoConsole(22980): Failed to load native module at path '/system/b2g/components/libxpcomsample.so': (80004005) dlopen failed: library "/system/b2g/components/libxpcomsample.so" not found
I/VolumeManager(22980): changing state from 'Uninitialized' to 'Starting'
I/VolumeManager(22980): Connected to vold
I/VolumeManager(22980): Volume sdcard (1): changing state from Init to Mounted @ '/storage/sdcard' (1 observers) mountGeneration = 1, locked = 1
I/VolumeManager(22980): Volume sdcard1 (2): changing state from Init to NoMedia (1 observers)
I/VolumeManager(22980): Volume sdcard1: IsRemovable set to 1 state NoMedia
I/VolumeManager(22980): Volume sdcard1: IsHotSwappable set to 1 state NoMedia
I/VolumeManager(22980): Unable to open volume configuration file '/system/etc/volume.cfg' - ignoring
I/VolumeManager(22980): READY: Volume: sdcard (1) is Mounted and inserted @ /storage/sdcard gen 1 locked 1
I/VolumeManager(22980): READY:   Sharing dis Mounting n Formating n Unmounting n
I/VolumeManager(22980): READY: Volume: sdcard1 (2) is NoMedia and missing @ /storage/sdcard1 gen -1 locked 1
I/VolumeManager(22980): READY:   Sharing dis Mounting n Formating n Unmounting n
I/VolumeManager(22980): changing state from 'Starting' to 'Volumes Ready'
I/AutoMounter(22980): AutoMounter state changed from IDLE to UMS_CONFIGURED
I/AutoMounter(22980): UpdateState: ums:A1C1E0 mtp:A1C0E0 mode:0 usb:1 tryToShare:0 state:UMS_CONFIGURED
I/AutoMounter(22980): UpdateState: Volume sdcard is Mounted and inserted @ /storage/sdcard gen 1 locked 1 sharing dis
I/AutoMounter(22980): UpdateState: Volume sdcard1 is NoMedia and missing
I/Gecko   (22980): 1428493361223	Marionette	INFO	marionette enabled via build flag and pref
D/nfcd    (  208): Socket connected
D/nfcd    (  208): void* NfcService::eventLoop(): NFCService msg=11
D/nfcd    (  208): processNotificaton notification=2000
D/nfcd    (  208): void NfcIpcSocket::writeToOutgoingQueue(uint8_t*, size_t) enter, data=0xb8d67e68, dataLen=20
D/nfcd    (  208): Writing 20 bytes to gecko
I/Gecko   (22980): 1428493361590	Marionette	INFO	marionette-server.js loaded
I/Gecko   (22980): 1428493361815	Marionette	INFO	B2G emulator: no
I/Gecko   (22980): 1428493361816	Marionette	INFO	Device detected is flame
I/Gecko   (22980): 1428493361818	Marionette	INFO	Listening on port 2828
I/Gecko   (22980):
I/Gecko   (22980): 1428493361818	Marionette	INFO	Marionette server ready
D/EventHub(22980): No input device configuration file found for device 'msm8x10-skuaa-snd-card Headset Jack'.
I/EventHub(22980): New device: id=1, fd=60, path='/dev/input/event8', name='msm8x10-skuaa-snd-card Headset Jack', classes=0x80, configuration='', keyLayout='', keyCharacterMap='', builtinKeyboard=false, usingSuspendBlockIoctl=true, usingClockIoctl=true
D/EventHub(22980): No input device configuration file found for device 'msm8x10-skuaa-snd-card Button Jack'.
W/EventHub(22980): Unable to disable kernel key repeat for /dev/input/event7: Function not implemented
I/EventHub(22980): New device: id=2, fd=61, path='/dev/input/event7', name='msm8x10-skuaa-snd-card Button Jack', classes=0x41, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false, usingSuspendBlockIoctl=true, usingClockIoctl=true
D/EventHub(22980): No input device configuration file found for device 'qpnp_pon'.
W/EventHub(22980): Unable to disable kernel key repeat for /dev/input/event5: Function not implemented
I/EventHub(22980): New device: id=3, fd=62, path='/dev/input/event5', name='qpnp_pon', classes=0x1, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false, usingSuspendBlockIoctl=true, usingClockIoctl=true
D/EventHub(22980): No input device configuration file found for device 'compass'.
D/EventHub(22980): No input device configuration file found for device 'bma2x2'.
D/EventHub(22980): No input device configuration file found for device 'stk3x1x-ps'.
D/EventHub(22980): No input device configuration file found for device 'stk3x1x-als'.
D/EventHub(22980): No input device configuration file found for device 'gpio-keys'.
W/EventHub(22980): Unable to disable kernel key repeat for /dev/input/event6: Function not implemented
It seems like we're dying from OOM. That's not surprising since we have no way to know when to GC the sockets objects that are held alive by the socket.opened.then() closure.
(Reporter)

Comment 2

3 years ago
I see. I was expecting those sockets to be GC'ed at some point. But... shouldn't this particular app only be killed, instead of the entire system?

Also, is there anywhere that documents said UDPSockets? I just found WebIDL pages.
If you can watch memory usage while your app runs (eg. with |adb shell b2g-info|) that would tell us if the parent process memory grows. I suspect that this is what's happening since the socket code is remoted to the parent process.

There's no doc that I know of. You know what to do ;)
(Reporter)

Updated

9 months ago
Status: NEW → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.