Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FORTIFY_SOURCE: FD_SET: file descriptor >= FD_SETSIZE. Calling abort()

Tags:

android

I'm a android programmer.

Today I run one android application that time I got this types of error.

FORTIFY_SOURCE: FD_SET: file descriptor >= FD_SETSIZE. Calling abort().

so please if any one know this answer for this problem please reply me.

like image 423
Chandru Sekar Avatar asked May 29 '15 05:05

Chandru Sekar


1 Answers

Your process has too many file descriptor or sockets open, and when the OS limit is reached, your app gets killed.

It is very unlikely that your app is legitimately using up all the resources, it is most likely a leak. You most probably miss a Close() call for a socket or a file resource.

I met this issue on various Android devices with the same code. The most common error signature was:

01-27 15:50:52.431 I/DEBUG   (  172): pid: 12444, tid: 19014, oom: 0, name: DrmRequestHandl  >>> YOUR_PACKAGE_NAME <<<
01-27 15:50:52.431 I/DEBUG   (  172): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-27 15:50:52.517 I/DEBUG   (  172): Abort message: 'FORTIFY_SOURCE: FD_SET: file descriptor >= FD_SETSIZE. Calling abort().'

You can check the descriptor limit on your device calling:

adb shell ulimit -n

As a first step to solve the issue, you might need to figure out what kind of resources are leaking. You can figure out the process ID of your app by:

 adb shell ps

Then using the process ID, while your app is still running, you can check for open descriptors (you need root access or debuggable app/ROM):

adb shell ls -l  /proc/[YOUR_PROCESS_ID]/fd

For the process 12345 it would be something like:

adb shell ls -l  /proc/12345/fd

This will list the descriptors. On older android versions you can have 1024 items in the list, on Lollipop I saw 2048 as the default limit.

For debuggable app, you can use run-as (see @Joe 's comment):

adb shell run-as com.mycompany.myapplication ls -l /proc/12345/fd
like image 112
Habib Avatar answered Oct 18 '22 12:10

Habib