Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Tue, 06 May 2003 13:47:26 -0400
From: Jason Tishler <jason@tishler.net>
Subject: cygipc (and PostgreSQL) XP problem resolved!
To: Cygwin <cygwin@cygwin.com>
Mail-followup-to: Cygwin <cygwin@cygwin.com>
Message-id: <20030506174725.GE1652@tishler.net>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_OLi4kw37qzBh/erp7nL8Ug)"
User-Agent: Mutt/1.4i

--Boundary_(ID_OLi4kw37qzBh/erp7nL8Ug)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline

Chuck,

Thanks to help from Frank Seesink, I was able to finally figure out why
cygipc and in turn PostgreSQL failed to work properly under XP in
certain situations.  See the attached for some of the details.

In summary, invoking the XP Fast User Switching feature causes XP to
start using multiple kernel object namespaces instead of a single global
one.  This in turn causes cygipc clients to fail to find a global
semaphore (i.e., \BaseNamedObjects\MultiSemSem_) created by ipc-daemon
and abort.

Are you willing to accept a cygipc patch to correct this problem?

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

--Boundary_(ID_OLi4kw37qzBh/erp7nL8Ug)
Content-type: message/rfc822

Received: from cust_req_fwding (jason@tishler.net --> jt@tishler.net)
 by lmg.ahnet.net id <294680-13825>; Tue, 06 May 2003 06:45:14 -0700
Received: from relay2.pgsql.com ([64.49.215.143]) by lmg.ahnet.net with ESMTP
 id <296025-13829>; Tue, 06 May 2003 06:44:26 -0700
Received: from postgresql.org (postgresql.org [64.49.215.8])
	by relay2.pgsql.com (Postfix) with ESMTP	id 4468D14723D; Tue,
 06 May 2003 09:44:19 -0400 (EDT)
Received: from spampd.localdomain (postgresql.org [64.49.215.8])
	by postgresql.org (Postfix) with ESMTP id 43FEA475E77	for
 <pgsql-cygwin@postgresql.org>; Tue, 06 May 2003 09:33:40 -0400 (EDT)
Received: from smtp-out.comcast.net (smtp-out.comcast.net [24.153.64.113])
	by postgresql.org (Postfix) with ESMTP id BBE83474E42	for
 <pgsql-cygwin@postgresql.org>; Tue, 06 May 2003 09:33:29 -0400 (EDT)
Received: from althea (pcp03112364pcs.eatntn01.nj.comcast.net [68.85.55.169])
 by mtaout03.icomcast.net
 (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003))
 with ESMTP id <0HEG003QKW8BQA@mtaout03.icomcast.net> for
 pgsql-cygwin@postgresql.org; Tue, 06 May 2003 09:31:23 -0400 (EDT)
Received: from [127.0.0.1] (helo=althea.tishler.net)
	by althea with smtp (Exim 4.12)	id HEGW9U-0001EG-00; Tue,
 06 May 2003 09:32:18 -0400
Received: by althea.tishler.net (sSMTP sendmail emulation); Tue,
 06 May 2003 09:32:17 -0400
Date: Tue, 06 May 2003 09:32:17 -0400
From: Jason Tishler <jason@tishler.net>
Subject: Re: [CYGWIN] initdb failure with PostgreSQL 7.3.2 / Cygwin 1.3.22-1 /
In-reply-to: <b96eei$s00$1@main.gmane.org>
Sender: pgsql-cygwin-owner@postgresql.org
To: Frank Seesink <frank@mail.wvnet.edu>
Cc: pgsql-cygwin@postgresql.org
Mail-followup-to: Frank Seesink <frank@mail.wvnet.edu>,
 pgsql-cygwin@postgresql.org
Message-id: <20030506133217.GA1652@tishler.net>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_u4ku1y4RVA/w2MQzoNfTZw)"
Precedence: bulk
User-Agent: Mutt/1.4i
X-Original-To: pgsql-cygwin@postgresql.org
X-Spam-Status: No,
 hits=-38.8 required=5.0	tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,
 REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MUTT	autolearn=ham	version=2.50
X-Spam-Level:
X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp)
References: <b8raen$k67$1@main.gmane.org> <20030502115828.GA1404@tishler.net>
 <b8u645$129$1@main.gmane.org> <20030502171115.GC1968@tishler.net>
 <b8unen$j6i$1@main.gmane.org> <3EB2E507.303@mail.wvnet.edu>
 <b8uqbo$vg3$1@main.gmane.org> <20030505121301.GE556@tishler.net>
 <20030505150010.GF556@tishler.net> <b96eei$s00$1@main.gmane.org>


--Boundary_(ID_u4ku1y4RVA/w2MQzoNfTZw)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline

Frank,

On Mon, May 05, 2003 at 03:36:56PM -0400, Frank Seesink wrote:
> Jason Tishler wrote:
> >[snip]
> >I did some more Googling.  Does the following apply to your setup?
> >
> >    http://support.microsoft.com/default.aspx?scid=kb;en-us;264651
> 
> [snip]
> But I believe the very act of using the Fast User Switching (where you
> 'Switch Users' without logging out) is what is causing this.

I have confirmed the above hypothesis with the attached test program,
cit2.c.  If cit2.exe is invoked as follows:

    $ cit2
    192 = OpenSemaphore(MultiSemSem_) succeeded

then it will work only under Terminal Services session 0 (i.e., the
first user to log on).

However, if cit2.exe is invoked as follows:

    $ cit2 1
    192 = OpenSemaphore(Global\MultiSemSem_) succeeded

then it will work under any Terminal Services session (i.e, even after a
Fast User Switch).

See the following MSDN article:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/termserv/termserv/kernel_object_namespaces.asp

which explains the multiple Terminal Services namespaces and how to
access them.

I will work with the cygipc maintainer to enhance cygipc to properly
handle Fast User Switching.

Your help in debugging this problem is greatly appreciated.

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

--Boundary_(ID_u4ku1y4RVA/w2MQzoNfTZw)
Content-type: text/plain; charset=us-ascii; NAME=cit2.c
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=cit2.c

#include <windows.h>
#include <stdio.h>

#define CYGWIN_IPCNT_SEMSEM "MultiSemSem_"
#define GLOBAL_CYGWIN_IPCNT_SEMSEM "Global\\MultiSemSem_"

int
main(int argc, char* argv[])
{
	HANDLE handle = 0;
	char* semaphore = CYGWIN_IPCNT_SEMSEM;

	if (argc > 1 && argv[1][0] == '1')
		semaphore = GLOBAL_CYGWIN_IPCNT_SEMSEM;

	handle = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, semaphore);
	if (handle)
	{
		printf("%ld = OpenSemaphore(%s) succeeded\n", handle, semaphore);
		CloseHandle(handle);
	}
	else
	{
		printf("OpenSemaphore(%s) failed with last error = %ld\n", semaphore,
			GetLastError());
	}

	return 0;
}

--Boundary_(ID_u4ku1y4RVA/w2MQzoNfTZw)
MIME-version: 1.0
Content-type: text/plain
Content-transfer-encoding: 7BIT
Content-disposition: inline


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--Boundary_(ID_u4ku1y4RVA/w2MQzoNfTZw)--


--Boundary_(ID_OLi4kw37qzBh/erp7nL8Ug)
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--Boundary_(ID_OLi4kw37qzBh/erp7nL8Ug)--
