[erlang-questions] open_port() slow on Windows

Daniel Goertzen <>
Tue Nov 8 23:19:16 CET 2011


I am observing slow behavior for open_port() on Windows.  The port program
itself starts up quickly, but open_port() itself hangs for several seconds
before returning... long after the port program is up and running.


Here is my instrumented Erlang code....

  io:format("~p opening port~n",[now()]),
  Port=open_port( {spawn_executable, Exe},
    [
     {cd, Dir},
     {args, Args},
     stream,
     binary,
     exit_status
    ]),
  io:format("~p done port~n",[now()]),


My port program is a python PyQt program.  One of the first things I have
it do is...

  logfile = open("c:\\logfile.txt","w")
  print(time.time(), "starting", file=logfile)



The output of my Erlang code interspersed with the above starting message
is....

{1320,789477,830000} opening port    [werl.exe]
  1320789478.968 starting                 [my_port_program.exe]
{1320,789483,337000} done port        [werl.exe]



Any idea why open_port() waits for so long before returning?


Thanks,
Dan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111108/bca5d657/attachment.html>


More information about the erlang-questions mailing list