[138531] branches/release_2_3/base

cal at macports.org cal at macports.org
Sat Jul 11 04:35:44 PDT 2015


Revision: 138531
          https://trac.macports.org/changeset/138531
Author:   cal at macports.org
Date:     2015-07-11 04:35:44 -0700 (Sat, 11 Jul 2015)
Log Message:
-----------
merge r138530 from trunk:
 base: darwintrace: close sockets when threads are terminated

 If a long-running process started and terminated a large number of processes,
 the file descriptors the were opened for these threads would not get closed.
 Instead, they would linger around in memory, unreferenced, until the process
 was terminated completely.

 This can cause exhaustion of file descriptors and fail builds. I've seen this
 behavior with GHC.

Revision Links:
--------------
    https://trac.macports.org/changeset/138530

Modified Paths:
--------------
    branches/release_2_3/base/src/darwintracelib1.0/darwintrace.c

Property Changed:
----------------
    branches/release_2_3/base/
    branches/release_2_3/base/src/


Property changes on: branches/release_2_3/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:118038-118039,118056,118085,118161,118559,118562-118569,118598-118599,118602-118603,118606-118607,118640,118735,119034,119169,119171,119175,119204,119297,119987,119992,120036,120038,120059-120060,120064,120067-120069,120074,120076,120127,120132,120142,120345,120382,120637,121311,121364,121451,121485,123652,124145-124146,124150,124216,125578,125621,125859,126475,126866,126868,126895,126900,128113,128274,128276,128422,134501-134502,134511
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:118038-118039,118056,118085,118161,118559,118562-118569,118598-118599,118602-118603,118606-118607,118640,118735,119034,119169,119171,119175,119204,119297,119987,119992,120036,120038,120059-120060,120064,120067-120069,120074,120076,120127,120132,120142,120345,120382,120637,121311,121364,121451,121485,123652,124145-124146,124150,124216,125578,125621,125859,126475,126866,126868,126895,126900,128113,128274,128276,128422,134501-134502,134511,138530
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692


Property changes on: branches/release_2_3/base/src
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base/src:37343-46937
/branches/gsoc09-logging/base/src:51231-60371
/branches/gsoc11-rev-upgrade/base/src:78828-88375
/branches/gsoc11-statistics/base/src:79520,79666
/branches/gsoc13-tests/src:106692-111324
/branches/universal-sanity/base/src:51872-52323
/branches/variant-descs-14482/base/src:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src:118038-118039,118056,118085,118161,118559,118562-118569,118598-118599,118602-118603,118606-118607,118640,118735,119034,119169,119171,119175,119204,119297,119987,119992,120036,120038,120059-120060,120064,120067-120069,120074,120076,120127,120132,120142,120345,120382,120637,121311,121364,121451,121485,123652,124145-124146,124150,124216,125578,125621,125859,126475,126866,126868,126895,126900,128113,128274,128276,128422,134501-134502,134511,135851
/users/perry/base-bugs_and_notes/src:45682-46060
/users/perry/base-select/src:44044-44692
   + /branches/gsoc08-privileges/base/src:37343-46937
/branches/gsoc09-logging/base/src:51231-60371
/branches/gsoc11-rev-upgrade/base/src:78828-88375
/branches/gsoc11-statistics/base/src:79520,79666
/branches/gsoc13-tests/src:106692-111324
/branches/universal-sanity/base/src:51872-52323
/branches/variant-descs-14482/base/src:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base/src:118038-118039,118056,118085,118161,118559,118562-118569,118598-118599,118602-118603,118606-118607,118640,118735,119034,119169,119171,119175,119204,119297,119987,119992,120036,120038,120059-120060,120064,120067-120069,120074,120076,120127,120132,120142,120345,120382,120637,121311,121364,121451,121485,123652,124145-124146,124150,124216,125578,125621,125859,126475,126866,126868,126895,126900,128113,128274,128276,128422,134501-134502,134511,135851,138530
/users/perry/base-bugs_and_notes/src:45682-46060
/users/perry/base-select/src:44044-44692

Modified: branches/release_2_3/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- branches/release_2_3/base/src/darwintracelib1.0/darwintrace.c	2015-07-11 11:14:59 UTC (rev 138530)
+++ branches/release_2_3/base/src/darwintracelib1.0/darwintrace.c	2015-07-11 11:35:44 UTC (rev 138531)
@@ -132,6 +132,13 @@
  */
 static char *filemap;
 
+static void __darwintrace_sock_destructor(FILE *dtsock) {
+	__darwintrace_close_sock = fileno(dtsock);
+	fclose(dtsock);
+	__darwintrace_close_sock = -1;
+	pthread_setspecific(sock_key, NULL);
+}
+
 /**
  * Setup method called as constructor to set up thread-local storage for the
  * thread id and the darwintrace socket.
@@ -141,7 +148,7 @@
 		perror("darwintrace: pthread_key_create");
 		abort();
 	}
-	if (0 != (errno = pthread_key_create(&sock_key, NULL))) {
+	if (0 != (errno = pthread_key_create(&sock_key, (void (*)(void *)) __darwintrace_sock_destructor))) {
 		perror("darwintrace: pthread_key_create");
 		abort();
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150711/45823825/attachment.html>


More information about the macports-changes mailing list