Clearing Connections

  • I have a computer called B which has port 53001 open in its firewall.

    And a programm on computer A does from time to time:
    NSConnection *outConnection = [[NSConnection alloc]
    initWithReceivePort: nil sendPort: porT ];

    outConnection now has a send port which uses port 53001 and a receive
    port which uses some port - let's call it 49175.

    now my programm does (1):
    NSDistantObject *serverProxy = [ outConnection rootProxy ];

    then it (2) converses with serverProxy.

    finally it does (3):
    [ outConnection invalidate ]; [ outConnection release ];

    So far so good.

    If after (1) we do: lsof -i 4 -a  -p <pid of  programm on A>  we see:

    ...  20u  IPv4 0x02d47b38      0t0  TCP *:49175 (LISTEN)
    ...  21u  IPv4 0x032e1de8      0t0  TCP 192.42.172.3:49176-
    > 192.42.172.5:53001 (ESTABLISHED)

    On computer B we get:
    ...  23u  IPv4 0x02667b70      0t0  TCP 192.42.172.5:53001->apfel:
    49176 (ESTABLISHED)

    192.42.172.3 = apfel = computer A
    192.42.172.5 = computer B

    And some time after (3) we see that these lines have disappeared.

    "Some time" is either immediately, or some minutes, or even some hours.

    In the latter case computer B eventually will have:
    ...  23u  IPv4 0x02667b70      0t0  TCP 192.42.172.5:53001->apfel:
    49176 (ESTABLISHED)
    ...  38u  IPv4 0x02762880      0t0  TCP 192.42.172.5:53001->apfel:
    49178 (ESTABLISHED)
    ...  69u  IPv4 0x026772a0      0t0  TCP 192.42.172.5:53001->apfel:
    49180 (ESTABLISHED)
    ...  98u  IPv4 0x02685e10      0t0  TCP 192.42.172.5:53001->apfel:
    49182 (ESTABLISHED)
    ...  111u  IPv4 0x026834f0      0t0  TCP 192.42.172.5:53001->apfel:
    49184 (ESTABLISHED)
    ...  128u  IPv4 0x0268b540      0t0  TCP 192.42.172.5:53001->apfel:
    49186 (ESTABLISHED)
    ...  145u  IPv4 0x026a2b70      0t0  TCP 192.42.172.5:53001->apfel:
    49188 (ESTABLISHED)
    ...  170u  IPv4 0x026a7880      0t0  TCP 192.42.172.5:53001->apfel:
    49190 (ESTABLISHED)
    ...  187u  IPv4 0x026a4690      0t0  TCP 192.42.172.5:53001->apfel:
    49192 (ESTABLISHED)
    ...  202u  IPv4 0x027219d0      0t0  TCP 192.42.172.5:53001->apfel:
    49194 (ESTABLISHED)
    ...  229u  IPv4 0x027289d0      0t0  TCP 192.42.172.5:53001->apfel:
    49196 (ESTABLISHED)
    ...  255u  IPv4 0x02748100      0t0  TCP 192.42.172.5:53001->apfel:
    49198 (ESTABLISHED)

    Now the programm on A will hang on (1). It does not get a timeout, it
    just hangs with:
    #0  0x9000ab48 in mach_msg_trap ()
    #1  0x9000aa9c in mach_msg ()
    #2  0x907dcb78 in __CFRunLoopRun ()
    #3  0x907dc47c in CFRunLoopRunSpecific ()
    #4  0x92952598 in -[NSConnection sendInvocation:] ()
    #5  0x92951034 in -[NSObject(NSForwardInvocation) forward::] ()
    #6  0x90a440b0 in _objc_msgForward ()
    #7  0x0023de14 in  --- the line with: serverProxy = [ outConnection
    rootProxy ]-----

    And when computer B now wants to write something to a file it gets:
    "POSIX error: Too many open files".
    Yes, getdtablesize() returns 256, but there are many unused slots
    which could and should be used.

    The question now: what can be done?
    How do I get computer B not to delay removing invalidated and closed
    connections from its list for more than an hour?

    Kind regards,

    Gerriet.
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today