error in orpc2 example 'clicks'

1 view
Skip to first unread message

ben kuin

unread,
Nov 18, 2009, 6:26:14 PM11/18/09
to ocamljs discuss
hi
after building the examples in the orpc2 folder I'd like to run the
'clicks' example. After adjusting the docroot I start the server with:

$ ./server.byte -fg -conf server.cfg

I get the error message:

[Wed Nov 18 10:43:55 2009] [netplex.controller] [crit] Uncaught
exception preparing service clicks: Unix.Unix_error(50, "bind", "")

there is no log file/facility AFAIK. any ideas how this can be
debugged?

thanks
ben

Jake Donham

unread,
Nov 18, 2009, 7:46:45 PM11/18/09
to ocamljs...@googlegroups.com
On Wed, Nov 18, 2009 at 3:26 PM, ben kuin <ben...@gmail.com> wrote:
> after building the examples in the orpc2 folder I'd like to run the
> 'clicks' example. After adjusting the docroot I start the server with:
>
>   $ ./server.byte -fg -conf server.cfg
>
> I get the error message:
>
> [Wed Nov 18 10:43:55 2009] [netplex.controller] [crit] Uncaught
> exception preparing service clicks: Unix.Unix_error(50, "bind", "")

I think you must have already started it (perhaps with the wrong
docroot?); you need to kill the other one. Or else something else is
occupying port 9007 (you can see the port in server.cfg). You can see
that Unix_error 50 is EADDRINUSE by counting 50 arms down the
Unix.error variant (unfortunately Printexc.to_string doesn't have the
variant labels).

Jake

ben kuin

unread,
Nov 19, 2009, 4:50:29 AM11/19/09
to ocamljs discuss
thanks for your help, here is what I've tried:

> something else is occupying port 9007
This is also the first thing I suspected, so I used lsof to check
this:
$ lsof -i :9007
but nothing is running here.

Netstat shows that 9007 is CONNECTED but there is no process attached
to it:
$ netstat -anp | grep '9007'
unix 3 [ ] STREAM CONNECTED 9007 -
So I think everything is fine here - no?

> I think you must have already started it (perhaps with the wrong docroot?)
Thanks. Since I've killed the hanging server with ctrl-c I didn't
think of that.
$ ps aux | grep 'server\.byte'
showed indeed three running servers which I've killed.
Then I run ./server.byte again. Same error message, but the server
don't shows up anymore in the processes. Strange.

I think the configuration of docroot is correct. I also tried to take
the server inside the '_build' folder, but I got the same error. So
maybe you can see if something is wrong here:

myhost:~/install/ocamljs/orpc2-read-only/examples/clicks
>$ ls
_build index.html myocamlbuild.ml README server.cfg _tags
clicks.ml Makefile proto.ml server.byte server.ml

myhost:~/install/ocamljs/orpc2-read-only/examples/clicks
>$ pwd
/home/benkuin/install/ocamljs/orpc2-read-only/examples/clicks

myhost:~/install/ocamljs/orpc2-read-only/examples/clicks
>$ cat server.cfg | grep docroot
docroot = "/home/benkuin/install/ocamljs/orpc2-read-only/
examples/clicks";

more ideas :-) ?


On Nov 19, 1:46 am, Jake Donham <jake.don...@gmail.com> wrote:

ben kuin

unread,
Nov 19, 2009, 6:12:33 AM11/19/09
to ocamljs discuss
I just made a little test with a simple socket server
~~~~~~~~~
....
let () =
let addr, port = Unix.inet_addr_loopback, 9007 in
Printf.printf "Echo server listening on 127.0.0.1:%d\n%!" port ;
let server_sock = Tcp.server_open 20 addr port in
Unix.set_nonblock server_sock ;
...
~~~~~~~~~~
It started und ran file! I think that means that the error
Unix.Unix_error(50, "bind", "") is not caused by my basic system
configuration.

>You can see that Unix_error 50 is EADDRINUSE
Is it possible that there is something wrong with this error status?

ben kuin

unread,
Nov 19, 2009, 6:28:21 AM11/19/09
to ocamljs discuss
ok - I finally got the 'clicks' example running by simply changing
'localhost' to 127.0.0.1 in server.cfg.

Is this a DNS issue? The strange thing is that usually the localhost
translation works without any problems (besides the clicks example)

~~~~~ vim /etc/hosts ~~~~~~~~~~~
127.0.0.1 localhost
127.0.0.1 myhost.localdomain myhost
192.168.1.40 lanserver
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefixff02::1 ip6-allnodes
ff02::2 ip6-allroutersff02::3 ip6-allhosts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Jake Donham

unread,
Nov 19, 2009, 2:13:24 PM11/19/09
to ocamljs...@googlegroups.com
On Thu, Nov 19, 2009 at 3:28 AM, ben kuin <ben...@gmail.com> wrote:
> ok - I finally got the 'clicks' example running by simply changing
> 'localhost' to 127.0.0.1 in server.cfg.
>
> Is this a DNS issue? The strange thing is that usually the localhost
> translation works without any problems (besides the clicks example)

That is strange; I have no explanation. Maybe it is an Ubuntu thing. I
installed 9.04 on VMWare player last night; I will try to get the
examples going there.

Jake

ben kuin

unread,
Nov 20, 2009, 9:17:37 AM11/20/09
to ocamljs discuss
>Maybe it is an Ubuntu thing.
I happen to think too.

In the mean time I've tried a few things with my hosts file. If you
don't want to use the ip adress this is how you have to make it (at
least on my system):

THAT WORKS:
$ head -n 1 /etc/hosts
127.0.0.1 localhost.localdomain localhost

$ cat server.cfg | grep address
address { type = "internet"; bind = "localhost.localdomain:
8080"; };

THAT DOESN'T WORK:
$ head -n 1 /etc/hosts
127.0.0.1 localhost

$ cat server.cfg | grep address
address { type = "internet"; bind = "localhost:8080"; };

pretty black magic, if you ask me ...


On Nov 19, 8:13 pm, Jake Donham <jake.don...@gmail.com> wrote:

Jake Donham

unread,
Nov 24, 2009, 12:08:02 AM11/24/09
to ocamljs...@googlegroups.com
I confirmed this problem on Ubuntu 9.04 and filed an orpc bug. I doubt
it has anything to do with orpc though. Maybe there is an Ocamlnet
problem.
> --
>
> You received this message because you are subscribed to the Google Groups "ocamljs discuss" group.
> To post to this group, send email to ocamljs...@googlegroups.com.
> To unsubscribe from this group, send email to ocamljs-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ocamljs-discuss?hl=.
>
>
>
Reply all
Reply to author
Forward
0 new messages