Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rshd running out of privileged ports



At 6:39 PM -0800 3/3/04, Mark Armstrong wrote:
Hello all,

We have a build environment based upon Microsoft VC++ which rsh's the build
commands to the Mac. If the compile-file rate is too high, we start getting
rshd errors. When rsh'ing rapidly, rshd on the Mac seems to be running out
of privileged ports to open stderr upon. The following script was created
to show and reproduce the errors. It has been run from various Unix
machines and a similar script has been run from a Window machine all with
the same errors occurring:

#!/bin/sh
loop=0
while [ $loop -lt 1000 ]; do
echo $loop;
rsh mackie sleep 0;
loop=$(( $loop + 1 ));
done

Each rsh only does a sleep. After 42 runs, the rshd errors with:
"can't get stderr port: Can't assign requested address"

This goes on for a while and then clears itself up after ~50 seconds. Then
the whole cycle starts over again.

I have enabled rshd through "xinetd.d/shell". I have tried to set various
kernel parameters and nothing seems to affect the outcome. It seems to have
lingering sockets, or something similar. I have taken the Darwin source for
rshd.c and modified it to try to resolve this problem with no luck.


Well, there's only 1024 reserved ports, and if rsh uses TCP, then they have to sit in CLOSE_WAIT for two minutes before being reused.

I'm surprised you don't see this on other platforms.

You said you modified rshd.c, what did you change?

You probably need to set SO_REUSEADDR on the socket.

http://www.unixguide.net/network/socketfaq/4.5.shtml


socket(...);

int p=1;
setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&p,sizeof(int));

bind(...);
listen(...);

-pmb
_______________________________________________
darwin-userlevel mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-userlevel
Do not post admin requests to the list. They will be ignored.


References: 
 >rshd running out of privileged ports (From: "Mark Armstrong" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.