public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
@ 2002-06-04  9:16 Michael Potter
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Potter @ 2002-06-04  9:16 UTC (permalink / raw)
  To: cygwin

> > here is the sample run:

> Your example code works fine with Cygwin
> from current cvs HEAD.  So I assume the problem has been fixed.
> 
> Corinna

thank you, thank you, thank you.
I have asked our sys admin to install the latest "cvs HEAD".

-- 
Michael Potter.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
  2002-06-06  7:51 Michael Potter
@ 2002-06-06  8:23 ` Corinna Vinschen
  0 siblings, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2002-06-06  8:23 UTC (permalink / raw)
  To: cygwin

On Thu, Jun 06, 2002 at 09:38:58AM -0500, Michael Potter wrote:
> We downloaded the latest snapshot (6/4) and it still fails on win2k.
> We are running the win2k box as a terminal server.
> 
> It runs successfully on ME with the 6/4 snapshot and with the 1.3.10.
> 
> Would anyone be interested in the strace of the failure?
> 
> Corinna, what opsys are you using?

XPp

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
@ 2002-06-06  7:51 Michael Potter
  2002-06-06  8:23 ` Corinna Vinschen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Potter @ 2002-06-06  7:51 UTC (permalink / raw)
  To: cygwin

We downloaded the latest snapshot (6/4) and it still fails on win2k.
We are running the win2k box as a terminal server.

It runs successfully on ME with the 6/4 snapshot and with the 1.3.10.

Would anyone be interested in the strace of the failure?

Corinna, what opsys are you using?

-- 
Michael Potter.

> Hi, I can verify that Corinna's observations are true on WindowsME
> with the latest cvs compiled cygwin. Cheers,
> 
> Nicholas
> 
> --- Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:
> > On Tue, Jun 04, 2002 at 03:08:12PM -0500, Michael Potter wrote:
> > > > On Mon, Jun 03, 2002 at 03:57:07PM -0500, Michael Potter wrote:
> > > > >
> > > > > Enclosed is a sample program that demonstrates a bug with
> > > > > mmap, fork, and sockets.  This sample is very similar to
> > > > > on submitted by me on june 2, but this one eliminiates sysV ipc.
> > > > >
> > > > > here is the sample run:
> > > >
> > > > Your example code works fine with Cygwin from current cvs HEAD.
> > > > So I assume the problem has been fixed.
> > > > Corinna
> > > >
> > >
> > > Corinna,
> > >
> > > We just tried the latest snap shot and the example fails.
> > >
> > > I want to confirm that you ran the sample properly.
> > >
> > > Did you do a "telnet hostname 5210" to allow the program to
> > > continue the the second fork, which fails?
> >
> > Yep:
> >
> > [~]$ ./x4
> > in pid = 760
> > entering NetWorkSocket
> > Port=5210, Socket=3, sinport=23060
> > exiting NetWorkSocket
> > entering accept
> > [~]$ after accept
> > in pid = 748
> > in pid = 608
> >
> > I tried it several times w/o problems.
> >
> > Corinna
> 

-- 
potter

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
  2002-06-05  5:11 ` Corinna Vinschen
@ 2002-06-05  6:05   ` Nicholas Wourms
  0 siblings, 0 replies; 8+ messages in thread
From: Nicholas Wourms @ 2002-06-05  6:05 UTC (permalink / raw)
  To: cygwin

Hi,

I can verify that Corinna's observations are true on WindowsME with the
latest cvs compiled cygwin.

Cheers,
Nicholas 
--- Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:
> On Tue, Jun 04, 2002 at 03:08:12PM -0500, Michael Potter wrote:
> > > On Mon, Jun 03, 2002 at 03:57:07PM -0500, Michael Potter wrote:
> > > >
> > > > Enclosed is a sample program that demonstrates a bug with
> > > > mmap, fork, and sockets.  This sample is very similar to
> > > > on submitted by me on june 2, but this one eliminiates sysV ipc.
> > > >
> > > > here is the sample run:
> > > 
> > > Your example code works fine with Cygwin from current cvs HEAD.
> > > So I assume the problem has been fixed.
> > > Corinna
> > > 
> > 
> > Corinna,
> > 
> > We just tried the latest snap shot and the example fails.
> > 
> > I want to confirm that you ran the sample properly.
> > 
> > Did you do a "telnet hostname 5210" to allow the program to
> > continue the the second fork, which fails?
> 
> Yep:
> 
> [~]$ ./x4
> in pid = 760
> entering NetWorkSocket
> Port=5210, Socket=3, sinport=23060
> exiting NetWorkSocket
> entering accept
> [~]$ after accept
> in pid = 748
> in pid = 608
> 
> I tried it several times w/o problems.
> 
> Corinna
> 
> -- 
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Developer                                mailto:cygwin@cygwin.com
> Red Hat, Inc.
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
  2002-06-04 13:13 Michael Potter
@ 2002-06-05  5:11 ` Corinna Vinschen
  2002-06-05  6:05   ` Nicholas Wourms
  0 siblings, 1 reply; 8+ messages in thread
From: Corinna Vinschen @ 2002-06-05  5:11 UTC (permalink / raw)
  To: cygwin

On Tue, Jun 04, 2002 at 03:08:12PM -0500, Michael Potter wrote:
> > On Mon, Jun 03, 2002 at 03:57:07PM -0500, Michael Potter wrote:
> > >
> > > Enclosed is a sample program that demonstrates a bug with
> > > mmap, fork, and sockets.  This sample is very similar to
> > > on submitted by me on june 2, but this one eliminiates sysV ipc.
> > >
> > > here is the sample run:
> > 
> > Your example code works fine with Cygwin from current cvs HEAD.
> > So I assume the problem has been fixed.
> > Corinna
> > 
> 
> Corinna,
> 
> We just tried the latest snap shot and the example fails.
> 
> I want to confirm that you ran the sample properly.
> 
> Did you do a "telnet hostname 5210" to allow the program to
> continue the the second fork, which fails?

Yep:

[~]$ ./x4
in pid = 760
entering NetWorkSocket
Port=5210, Socket=3, sinport=23060
exiting NetWorkSocket
entering accept
[~]$ after accept
in pid = 748
in pid = 608

I tried it several times w/o problems.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
@ 2002-06-04 13:13 Michael Potter
  2002-06-05  5:11 ` Corinna Vinschen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Potter @ 2002-06-04 13:13 UTC (permalink / raw)
  To: cygwin

> On Mon, Jun 03, 2002 at 03:57:07PM -0500, Michael Potter wrote:
> >
> > Enclosed is a sample program that demonstrates a bug with
> > mmap, fork, and sockets.  This sample is very similar to
> > on submitted by me on june 2, but this one eliminiates sysV ipc.
> >
> > here is the sample run:
> 
> Your example code works fine with Cygwin from current cvs HEAD.
> So I assume the problem has been fixed.
> Corinna
> 

Corinna,

We just tried the latest snap shot and the example fails.

I want to confirm that you ran the sample properly.

Did you do a "telnet hostname 5210" to allow the program to
continue the the second fork, which fails?

You will get the command prompt back because the sample
"daemonizes", but you need to telnet to it to allow
the daemon to continue.

-- 
Michael Potter

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
  2002-06-03 13:57 Michael Potter
@ 2002-06-04  4:10 ` Corinna Vinschen
  0 siblings, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2002-06-04  4:10 UTC (permalink / raw)
  To: cygwin

On Mon, Jun 03, 2002 at 03:57:07PM -0500, Michael Potter wrote:
> 
> Enclosed is a sample program that demonstrates a bug with
> mmap, fork, and sockets.  This sample is very similar to
> on submitted by me on june 2, but this one eliminiates sysV ipc.
> 
> here is the sample run:

Your example code works fine with Cygwin from current cvs HEAD.
So I assume the problem has been fixed.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork
@ 2002-06-03 13:57 Michael Potter
  2002-06-04  4:10 ` Corinna Vinschen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Potter @ 2002-06-03 13:57 UTC (permalink / raw)
  To: cygwin


Enclosed is a sample program that demonstrates a bug with
mmap, fork, and sockets.  This sample is very similar to
on submitted by me on june 2, but this one eliminiates sysV ipc.

here is the sample run:

 [@TERMSERV]/cygdrive/c/apps/apwin1/src/forktest>
-> gcc -oforktest2 forktest2.c
 [@TERMSERV]/cygdrive/c/apps/apwin1/src/forktest>
-> ./forktest2
in pid = 2276
entering NetWorkSocket
Port=5210, Socket=3, sinport=23060
exiting NetWorkSocket
entering accept
 [@TERMSERV]/cygdrive/c/apps/apwin1/src/forktest>
-> after accept
in pid = 6880
   1963 [main] forktest2 7220 fixup_mmaps_after_fork: base address fails to matc
h requested address 0x650000
c:\apps\apwin1\src\forktest\forktest2.exe: *** recreate_mmaps_after_fork_failed

Note: you have to telnet to port 5210 to allow the program to continue.


----------------------------------------------------------------------
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#  include <unistd.h>
#  include <sys/mman.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>

static int RegProcNet_sd;
static struct sockaddr_in Sin;
static const int on = 1;

int SwitchToPrivate_sd(void)
{
   int NewNet_sd;
   unsigned long SizeOfsockaddr_in = sizeof (struct sockaddr_in);

   printf("entering accept\n");
   NewNet_sd = accept(RegProcNet_sd, (struct sockaddr *)&Sin,
    (size_t *)&SizeOfsockaddr_in);

   printf("after accept\n");

   if (NewNet_sd < 0)
   {
      int SaveErrNo = errno;
      printf("Exiting due to error in accept %d\n", SaveErrNo);
      exit(1);
   }
   return(NewNet_sd);
}

#define PORT_NUM 5210

void NetWorkSocket(void)
{

   int SizeOfsockaddr_in = sizeof (struct sockaddr_in);
   bzero((char *) &Sin, sizeof(Sin));
   Sin.sin_family = AF_INET; 
   Sin.sin_addr.s_addr = htonl(INADDR_ANY) ;
   Sin.sin_port = htons((unsigned short)PORT_NUM);

   printf("entering NetWorkSocket\n");

   RegProcNet_sd = socket(AF_INET, SOCK_STREAM, 0);
   if (RegProcNet_sd < 0)
   {
      int SaveErrNo = errno;
      printf("Exiting due to error in socket %d\n", SaveErrNo);
      exit(1);
   }
   
   (void) setsockopt(RegProcNet_sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
   
   if (bind(RegProcNet_sd, (struct sockaddr *)&Sin, SizeOfsockaddr_in) < 0)
   {
      int SaveErrNo = errno;
      printf("Exiting due to error in bind %d\n", SaveErrNo);
      exit(1);
   }

   if (listen(RegProcNet_sd, 1) < 0)
   {
      int SaveErrNo = errno;
      printf("Exiting due to error in listen %d\n", SaveErrNo);
      exit(1);
   }
   {
      printf("Port=%d, Socket=%d, sinport=%d\n",
                              PORT_NUM, RegProcNet_sd, Sin.sin_port);
   }
   printf("exiting NetWorkSocket\n");
   return;
}


int main(int argc, char *argv[])
{
   char *shmptr3;
   int SaveErrno;
   int sd;

   if (fork())
   {
      printf("in pid = %d\n", getpid());
      exit(0);
   }

   shmptr3 = mmap(0, 1024*1024, PROT_READ|PROT_WRITE,
                            MAP_ANONYMOUS|MAP_SHARED, -1, 0);

   if (shmptr3 == (char *)-1)
   {
      SaveErrno = errno;
      printf("mmap failed errno = %d\n", SaveErrno);
      exit(1);
   }

   NetWorkSocket();

   sd = SwitchToPrivate_sd();

   fork();
   printf("in pid = %d\n", getpid());
   exit(0);
}
----------------------------------------------------------------------

-- 
Michael Potter

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-06-06 15:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-04  9:16 cygwin 1.3.10 mmap+fork+sockets=fixup_mmaps_after_fork Michael Potter
  -- strict thread matches above, loose matches on Subject: below --
2002-06-06  7:51 Michael Potter
2002-06-06  8:23 ` Corinna Vinschen
2002-06-04 13:13 Michael Potter
2002-06-05  5:11 ` Corinna Vinschen
2002-06-05  6:05   ` Nicholas Wourms
2002-06-03 13:57 Michael Potter
2002-06-04  4:10 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).