From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31143 invoked by alias); 4 Apr 2011 12:49:45 -0000 Received: (qmail 31132 invoked by uid 22791); 4 Apr 2011 12:49:44 -0000 X-SWARE-Spam-Status: No, hits=0.0 required=5.0 tests=AWL,BAYES_00,TW_MQ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from vpn.ubitronix.com (HELO mail.ubitronix.com) (194.187.178.82) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Apr 2011 12:49:38 +0000 Received: from ex01-ubitronix.ubitronix.local ([10.1.10.11]) by ex01-ubitronix.ubitronix.local ([10.1.10.11]) with mapi; Mon, 4 Apr 2011 14:49:51 +0200 From: Manuel Wienand To: "cygwin@cygwin.com" Date: Mon, 04 Apr 2011 13:06:00 -0000 Subject: 1.7.9: mq_unlink/mq_open leaks handles Message-ID: <0C11C5BF0B29FD43A8D0250F711D497F89DC3AE22B@ex01-ubitronix.ubitronix.local> x-esetresult: clean, is OK x-esetid: 457DA920DB39A03D163D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-04/txt/msg00055.txt.bz2 Hallo, it seems that mq_unlink and/or mq_open forget to close some handles (5 to b= e precise). How to test: Execute the following code and watch the number of handles in the windows t= ask-manager (processes tab, you can add a column there). For me it increase= s by 5 with every loop. Tested with this DLL: cygwin1-20110327.dll Thanks, Manuel #include #include #include #include #include #include #include int main(void) { int res; int i =3D 0; char msgQueueTestName[] =3D "./testQueue"; mqd_t testQueue; struct mq_attr attrQueue; memset(&attrQueue,0x00,sizeof(attrQueue)); attrQueue.mq_maxmsg =3D 10; /* room for X messages in the queue */ attrQueue.mq_msgsize =3D 20; /* maximum size of a message */ while(1) { sleep(1); i++; printf("Loop #%d\n", i); fflush(stdout); // Remove old queues before trying to create a new one. res =3D mq_unlink(msgQueueTestName); if ((res =3D=3D -1) && (errno !=3D ENOENT)) { // Don't print anything if the queue can't be unlinked, because it do= esn't exist. printf("Failed to unlink msg queue %s: %s %d\n", msgQueueTestName, sys= _errlist[errno],errno); } testQueue =3D mq_open(msgQueueTestName, O_RDWR | O_CREAT | O_EXCL, S_IR= WXU | S_IRWXG, &attrQueue); if( testQueue =3D=3D (mqd_t)-1 ) { printf("Failed to open msg queue %s: %s %d\n", msgQueueTestName, sys_= errlist[errno],errno); } res =3D mq_unlink(msgQueueTestName); if (res =3D=3D -1) { printf("Failed to unlink msg queue %s: %s %d\n", msgQueueTestName, sy= s_errlist[errno],errno); } } return EXIT_SUCCESS; } -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple