Fix socket descriptor leak from Zygote to child app
Due to an API change in LocalSocket, Zygote must now manually close the FileDescriptor it created when it registered a LocalServerSocket. The LocalSocket.close() routine will no longer do so. Bug: 12114500 Change-Id: I8c9fb073924ac33d594bd3bd0eb11d3d1d402506
This commit is contained in:
@@ -192,10 +192,16 @@ public class ZygoteInit {
|
||||
static void closeServerSocket() {
|
||||
try {
|
||||
if (sServerSocket != null) {
|
||||
FileDescriptor fd = sServerSocket.getFileDescriptor();
|
||||
sServerSocket.close();
|
||||
if (fd != null) {
|
||||
Libcore.os.close(fd);
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, "Zygote: error closing sockets", ex);
|
||||
} catch (libcore.io.ErrnoException ex) {
|
||||
Log.e(TAG, "Zygote: error closing descriptor", ex);
|
||||
}
|
||||
|
||||
sServerSocket = null;
|
||||
|
||||
Reference in New Issue
Block a user