Bugs item #559987, was opened at 2002-05-24 00:40
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=559987&group_id=8032

Category: hslibs/net
Group: 5.02
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: accept does reverse DNS lookup

Initial Comment:
If "accept" gets a connection where the connecting machine
cannot be found via a reverse DNS lookup, it throws an
exception.  I noticed this when I tried connecting to a
server made with GHC from inside a network that has real
IP numbers but no reverse DNS entries, and have had
reports of the same problems from inside similar networks.
If I disable the server's DNS lookups, connections fail
from everywhere.  This is the exception:

exception during accept: does not exist
Action: getHostByAddr
Reason: no such host entry

I'm fairly sure this isn't an OS quirk, since the
machine I'm
testing on runs lots of other services that don't have this
problem, it seems to be a problem for GHC servers.

As you can see from this snippet:

    aResult <- try (accept s)
      case aResult of
        Right (h,_,port) -> do
          pid <- forkIO (do
          c1 <- takeMVar cc
          if c1 == 0 then takeMVar l else return ()
          putMVar cc (c1 + 1)

          handler state h

          c2 <- takeMVar cc
          if c2 == 1 then putMVar l () else return ()
          putMVar cc (c2-1))
          return ()
        Left e -> do
--DEBUG
          putStrLn ("exception during accept: " ++ show e)
          return ()

I never actually demand the connecting host name, so
I would hope the lookup wouldn't happen

I'm testing on a RH 7.1 x86, with the GHC 5.02.

Sample code attached



----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-05-27 05:52

Message:
Logged In: NO 

Thank you for the work-around, using SocketPrim
and doing the socket - bind - accept at that level
works fine.

----------------------------------------------------------------------

Comment By: Volker Stolz (volkersf)
Date: 2002-05-26 00:02

Message:
Logged In: YES 
user_id=126328

You can work around this by using SocketPrim.accept, take a 
look at Socket.lhs on how it is used there.

Maybe the corresponding error should be caught inside Socket 
and the tuple be changed to 'Maybe HostEntry'? OTOH Socket 
(now Network) has always been rather high-level with funny 
things like 'recvFrom', so for practical purposes, you'd end up 
using SocketPrim anyway.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=559987&group_id=8032
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to