question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android crashes because Admob creates too many File Descriptors

See original GitHub issue

Problem

I’m getting crashes from the Google Play Console because my game reaches the limit of max FileDescriptor object count:

"FORTIFY: FD_SET: file descriptor 1247 >= FD_SETSIZE 1024"

Upon investigating I found out that for each loaded ad Admob SDK creates about ~300-400 FileDescriptor objects. So while my game is idle it uses about 200-300, when I load an Interstitial and a Rewarded it reaches the max limit of 1024.

And one more issue: FileDescriptors are not released when the ad is loaded and then destroyed without showing it, which makes it possible to grow FileDescriptor count infinitely.

Note: Reaching the limit does not cause the game to crash immediately, but the game crashes when other SDKs interact with File Descriptors.

Environment

Steps to reproduce:

  1. Download the official Hello World sample, and integrate the Admob SDK or Download this project
  2. Build in development mode and run on Android
  3. Connect the device and observe the File Descriptor usage using the ADB shell. You can use this Power Shell script
  4. Initially the usage will be around 200, after loading an Interstitial and a Rewarded it will grow significantly, and may reach the limit.

Demonstration video: https://youtu.be/xju_E4rvRG8

Relevant Code:

Sample Project Google Drive Link Power Shell script that I use to print File Descriptor usage Github Link An article that may be helpful Keeping File Descriptors (FD’s) in check on Android

Issue Analytics

  • State:open
  • Created 2 months ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
atonvisioncommented, Jul 28, 2023

Same here

1reaction
atonvisioncommented, Jul 29, 2023

Plugin v8.4.1

Unity version 2022.3.5f1 Android 10 , 11
Application just closed before open any thing even unity splash screen

Read more comments on GitHub >

github_iconTop Results From Across the Web

Too many threads created by admob SDK.
I use a new project created by Android Studio for testing. 1. Start MainActivity with any code change, there are about less then...
Read more >
Game crashes on Android after using AdMob with Google ...
the solution for GPGS 0.9.64 and AdMob 0.18.0 is in player settings check proguard option and that will creat an empty proguard file...
Read more >
expo app crashing at the start (google play)
If I don't include adaptiveIcon under android, the app crashes. The only way it won't crash is to include adaptiveIcon linked to a...
Read more >
Crashes | App quality
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
Game crashes on start up after implementing Admob
Another tip, after making the build, is to check if the id was applied correctly by going to assets / plugins / android...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found