Memory leak due to noise suppression

Description

About twice a day Audiorelay crases because of null pointer exception. Server is running on Win10 21H1 and client is an android phone. They are connected via a LAN and not USB tethered.

This started happening after I upgraded the Audiorelay server to the latest version.

Log excerpt:

2022-07-08 17:11:53,312 INFO Remote device connected: 192.168.0.147
2022-07-08 17:11:53,324 INFO Received client config, clientVersion: 0.25.5, os: ANDROID, osVersion: Android API 30
2022-07-08 17:11:53,336 INFO Asking backend to start capture. EventSync: true, ContinuousStream: true, AudioConfig: AudioConfig(sampleRate=48000, bits=16, channels=2), AudioDevice: Speakers (2- USB Audio CODEC ), 
2022-07-08 17:11:53,845 INFO Audio pipeline is emitting values
2022-07-08 17:36:22,399 ERROR Stopping the session due to an error
s40: null
	at r40.a(SourceFile:2) ~[audiorelay.jar:?]
	at FD0.a(SourceFile:52) ~[audiorelay.jar:?]
	at C90.b(SourceFile:5) [audiorelay.jar:?]
	at l90.a(SourceFile:112) [audiorelay.jar:?]
	at pb0.run(SourceFile:1) [audiorelay.jar:?]
	at St.run(SourceFile:5) [audiorelay.jar:?]
	at RW.run(SourceFile:4) [audiorelay.jar:?]
	at pU0.run(SourceFile:1) [audiorelay.jar:?]
	at tf.run(SourceFile:23) [audiorelay.jar:?]
2022-07-08 17:36:22,401 INFO Remote device disconnected: 192.168.0.147...
2022-07-08 17:36:22,403 INFO Asking backend to stop capture...

Devices

Phone:
Android 11
Xiaomi Redmi 5G
AudioRelay 0.25.5

Desktop:
Windows 10
AudioRelay 0.25.5

This exception is raised when there’s a network issue but, it shouldn’t be fatal. The Android app should automatically try to reconnect for a few minutes.

When you say crash, does that mean that the Desktop app completely shutdowns and, you have to restart it?
If so, isn’t there more logs than what you’ve posted?

If the Desktop app is still running, we could check why the Android app stops retrying to connect.
Getting the logs is a bit more involved:

The Android app doesn’t store log messages itself so using ADB is necessary.
You would need to do these steps:

  • Get ADB and enable USB debugging
  • Open a terminal
  • Confirm that your device is available via the command adb devices
  • Type adb logcat --clear to remove all the previous logs
  • Type adb logcat > logcat-output.txt to write the new logs to a file
  • In the Android App, connect normally
  • Wait until the Android app stops working
  • In the terminal, stop the log collection by doing CTRL C
  • Post the logcat-output.txt file here

Hi, I have a very similar problem. My connection started randomly resetting starting a few weeks ago. The android app seems to completely restart in the background and forgets that a connection was active, once restarted the PC reconnects automatically.

I do get null as an exception message sometimes as well, but it’s a M40 code. If that’s a different thing I can post this message as a new thread.

Catching the null message as android logs is kinda hard since I had it happen once today and once 4 days ago. The rest have different disconnect messages. (Disclaimer: I sometimes shut down the android server to “mute” my mic, those will probably show up in the PC logs - but then I don’t kill the sound connection)

I have now updated to 0.25.5 but since the only changelogs are localization I’ll post the logs regardless.

Devices

Phone:
Android 12
Google Pixel 4a
AudioRelay 0.25.5

Desktop:
Windows 10
AudioRelay 0.25.4

Since the android logs are freaking huge and I’m not allowed to attach txt files here (and have a character limitation), I’ve uploaded the logs to google drive. I have uploaded the logs from today and 4 days ago (Line 318 for that one) and also the android logs.
https://drive.google.com/drive/folders/1fzILJBSS75rxdg3YOnBvyOWfrcJCg7ED?usp=sharing

Hi, thanks for the logs!
In your case, it’s due to the Android app crashing. The Desktop app is simply printing network errors.
Here are the relevant lines from the Android logs:

08-11 23:41:49.947 17918 19990 I scudo : Scudo ERROR: internal map failure (NO MEMORY) requesting 4KB
08-11 23:41:49.947 17918 19984 W libc : malloc(1504) failed: returning null pointer
[…]
08-11 23:41:50.252 17918 18982 W libc : malloc(960) failed: returning null pointer
08-11 23:41:50.252 17918 17967 W libc : malloc(6800) failed: returning null pointer
[…]
08-11 23:41:50.647 17918 18982 E libc++abi: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc
[…]
--------- beginning of crash
08-11 23:41:51.117 17918 18982 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 18982 (Server:AudioCap), pid 17918 (sw.audioconnect)

Could you please confirm whether you’ve enabled Noise suppression in the app’s server tab?
I found a related piece of code that could lead to memory issues.

I have indeed enabled “Noise suppression (RNNoise)”.

Volume boost is disabled and Microphone mode is in default mode.

In that case I’ll disable that and see if I keep crashing in case you need more info.

1 Like

Just a note: Since I disabled the noise suppression i haven’t had any crashes.

So this workaround works for me and my mentionend problems all seem to stem from the Noise suppression.

1 Like

A fix is rolling out, thanks for the report!

1 Like