Re: [ocamlnet 3.6] SOLVED Netplex broken on Mac OS X 10.4 PPC

Matías Giovannini <[email protected]> Fri, 28 Sep 2012 16:55:39 -0300
Newsgroups gmane.comp.lang.ocaml.lib.net.devel
Message-ID <CALzEXo_e9Wd93nZo64YwwoSGufJbmuhV+ZAMvzSDvPw-AT8jWw@mail.gmail.com>
--===============7296778514222541166==
Content-Type: multipart/alternative; boundary=20cf3005144aaacd9904cac870bf

--20cf3005144aaacd9904cac870bf
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Well, after a long detour I found and *fixed* the issue. After many hours
trying to backport to Ocamlnet 2.x, I found that the root cause is the one
identified by Joel Reymont back in 2007:
http://caml.inria.fr/pub/ml-archives/caml-list/2007/05/0a6a0d3113993e5eefcc=
b7cc3aa3eebe.en.html

Here are my diffs against 3.6:

~/src/ocamlnet-3.6> diff configure configure.orig
450,452c450,455
<   int i =3D 1;
<   char* s =3D (char*) &i;
<   return (s[0] =3D=3D 0 ? Val_true : Val_false);
---
>   union {
>     int i;
>     char s[4];
>   } u;
>   u.i =3D 0x0001010101;
>   return (u.s[0] =3D=3D 0 ? Val_true : Val_false);

~/src/ocamlnet-3.6/src/netzip> diff netgzip.ml netgzip.ml.orig
326c326
<     ~encoder:(new deflating_pipe ~level:6)
---
>     ~encoder:(new deflating_pipe)

~/src/ocamlnet-3.6/src/netsys> diff netsys.ml netsys.ml.orig125,127d124
<     | Unix.Unix_error(Unix.EAFNOSUPPORT,_,_) ->
<     (* On older Mac OS X, getpeername on a pipe return EAFNOSUPPORT;
assume *)
< `Read_write

~/src/ocamlnet-3.6/src/equeue> diff uq_engines.ml uq_engines.ml.orig
3132c3132
<   try match Netsys.getpeername s with
---
>   match Netsys.getpeername s with
3137,3138d3136
<   with Unix.Unix_error (Unix.EAFNOSUPPORT, _, _)
<     `Sock_unix(stype, "")
3143c3141
<   try match Netsys.getpeername s with
---
>   match Netsys.getpeername s with
3148,3149d3145
<   with Unix.Unix_error (Unix.EAFNOSUPPORT, _, _)
< None


On Wed, Sep 26, 2012 at 9:15 PM, Mat=C3=ADas Giovannini <[email protected]=
>wrote:

> Hi,
>
> I send out in the hopes that, despite the ancient software and platform
> I'm having problems with, someone could shed some light on this. Currentl=
y
> netplex is broken on this machine, failing with errors of the following
> sort:
>
> fd style: Recv_send_implied
> fd style: Recv_send_implied
> Netplex Catastrophic Error: Unable to send log message - exception
> Rpc_client.Communication_error(File "uq_engines.ml", line 2576,
> characters 6-12: Assertion failed)
> Log message is: poll: Exception Rpc_client.Communication_error(File "
> uq_engines.ml", line 2576, characters 6-12: Assertion failed)
> [Wed Sep 26 21:10:39 2012] [netplex.controller] [alert] Disabling service
> after 10 startup failures
>
> (the "fd_style" line is a strategically placed print statement). I am at =
a
> loss in following uq_engines.ml, so I don't know where to look.
>
> I configured ocamlnet with:
>
> ./configure -with-nethttpd -enable-zip -disable-tcl -prefer-netcgi2
> -enable-pcre
>
> and the result is:
>
> able-tcl -prefer-netcgi2 -enable-pcre
> Welcome to Ocamlnet version 3.6
> Checking operating system... Generic
> Checking for findlib... found
> Checking multi-threading support... posix (ok)
> Checking word size... 32 bit
> Checking endianess... big
> Checking for GPROF... found
> Checking for PCRE... found
> Checking for win32... no
> Checking whether Ocaml has Printexc.register_printer... found
> Checking for POSIX pthread... found
> Checking whether Ocaml has fancy page tables... found
> Checking for POSIX shared memory... found
> Checking for POSIX semaphores (anonymous)... not found
> Checking for POSIX semaphores (named)... found
> Checking for POSIX spawn... not found
> Checking for POSIX fadvise... not found
> Checking for POSIX fallocate... not found
> Checking for POSIX memalign... not found
> Checking for syslog... found
> Checking for POSIX functions like openat... not found
> Checking for fchdir... found
> Checking for fdopendir... not found
> Checking for realpath... not found
> Checking for grantpt (System V style PTYs)... found
> Checking for posix_openpt (System V style PTYs)... found
> Checking for initgroups...found
> Checking for POSIX clocks...not found
> Checking for POSIX timers...not found
> Checking for eventfd (Linux)...not found
> Checking for timerfd (Linux)...not found
> Checking for epoll (Linux)...not found
> Checking for compare_and_swap (GCC)...not found
> Checking for GPROF... found
> Checking for O_SHARE_DELETE... yes
> Checking for getpeereid... found
> Checking for getpeerucred... not found
> Checking for camlzip... found
> Preprocessor for ocamlrpcgen: cpp
>
> Effective options:
>     -enable-pcre
>     -disable-gtk
>     -disable-gtk2
>     -disable-tcl
>     -disable-ssl
>     -enable-zip
>     -disable-crypto
>     -disable-apache
>     -with-nethttpd
>     -without-rpc-auth-dh
>     -bindir /opt/ocaml/bin
>     -datadir /opt/ocaml/lib/site-lib/netstring
>     -cpp cpp
>
> uname -a is "Darwin Blue.local 8.11.0 Darwin Kernel Version 8.11.0: Wed
> Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintos=
h
> powerpc", ocaml -version is "The OCaml toplevel, version 4.00.0" and gcc
> --version gives:
>
> powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build
> 5370)
> Copyright (C) 2005 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is N=
O
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOS=
E.
>
> (prehistoric, I know). If anyone has any ideas, I'd be grateful (except
> for suggestions to run Linux! ;-)
>
> Best regards,
> Mat=C3=ADas.
>

--20cf3005144aaacd9904cac870bf
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Well, after a long detour I found and <b>fixed</b>=C2=A0the issue. After ma=
ny hours trying to backport to Ocamlnet 2.x, I found that the root cause is=
 the one identified by Joel Reymont back in 2007:=C2=A0<a href=3D"http://ca=
ml.inria.fr/pub/ml-archives/caml-list/2007/05/0a6a0d3113993e5eefccb7cc3aa3e=
ebe.en.html">http://caml.inria.fr/pub/ml-archives/caml-list/2007/05/0a6a0d3=
113993e5eefccb7cc3aa3eebe.en.html</a><div>
<br></div><div>Here are my diffs against 3.6:</div><div><br></div><div><div=
><font face=3D"courier new, monospace">~/src/ocamlnet-3.6&gt; diff configur=
e configure.orig=C2=A0</font></div><div><font face=3D"courier new, monospac=
e">450,452c450,455</font></div>
<div><font face=3D"courier new, monospace">&lt; =C2=A0 int i =3D 1;</font><=
/div><div><font face=3D"courier new, monospace">&lt; =C2=A0 char* s =3D (ch=
ar*) &amp;i;</font></div><div><font face=3D"courier new, monospace">&lt; =
=C2=A0 return (s[0] =3D=3D 0 ? Val_true : Val_false);</font></div>
<div><font face=3D"courier new, monospace">---</font></div><div><font face=
=3D"courier new, monospace">&gt; =C2=A0 union {</font></div><div><font face=
=3D"courier new, monospace">&gt; =C2=A0 =C2=A0 int i;</font></div><div><fon=
t face=3D"courier new, monospace">&gt; =C2=A0 =C2=A0 char s[4];</font></div=
>
<div><font face=3D"courier new, monospace">&gt; =C2=A0 } u;</font></div><di=
v><font face=3D"courier new, monospace">&gt; =C2=A0 u.i =3D 0x0001010101;</=
font></div><div><font face=3D"courier new, monospace">&gt; =C2=A0 return (u=
.s[0] =3D=3D 0 ? Val_true : Val_false);</font></div>
<div><font face=3D"courier new, monospace"><br></font></div><div><font face=
=3D"courier new, monospace">~/src/ocamlnet-3.6/src/netzip&gt; diff <a href=
=3D"http://netgzip.ml">netgzip.ml</a> netgzip.ml.orig=C2=A0</font></div><di=
v><font face=3D"courier new, monospace">326c326</font></div>
<div><font face=3D"courier new, monospace">&lt; =C2=A0 =C2=A0 ~encoder:(new=
 deflating_pipe ~level:6)</font></div><div><font face=3D"courier new, monos=
pace">---</font></div><div><font face=3D"courier new, monospace">&gt; =C2=
=A0 =C2=A0 ~encoder:(new deflating_pipe)</font></div>
<div><font face=3D"courier new, monospace"><br></font></div><div><font face=
=3D"courier new, monospace">~/src/ocamlnet-3.6/src/netsys&gt; diff <a href=
=3D"http://netsys.ml">netsys.ml</a> netsys.ml.orig125,127d124</font></div><=
div>
<font face=3D"courier new, monospace">&lt; <span class=3D"Apple-tab-span" s=
tyle=3D"white-space:pre">	</span> =C2=A0 =C2=A0| Unix.Unix_error(Unix.EAFNO=
SUPPORT,_,_) -&gt;</font></div><div><font face=3D"courier new, monospace">&=
lt; <span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =C2=
=A0 =C2=A0(* On older Mac OS X, getpeername on a pipe return EAFNOSUPPORT; =
assume *)</font></div>
<div><font face=3D"courier new, monospace">&lt; <span class=3D"Apple-tab-sp=
an" style=3D"white-space:pre">		</span>`Read_write</font></div><div><font f=
ace=3D"courier new, monospace"><br></font></div><div><font face=3D"courier =
new, monospace">~/src/ocamlnet-3.6/src/equeue&gt; diff <a href=3D"http://uq=
_engines.ml">uq_engines.ml</a> uq_engines.ml.orig=C2=A0</font></div>
<div><font face=3D"courier new, monospace">3132c3132</font></div><div><font=
 face=3D"courier new, monospace">&lt; =C2=A0 try match Netsys.getpeername s=
 with</font></div><div><font face=3D"courier new, monospace">---</font></di=
v><div>
<font face=3D"courier new, monospace">&gt; =C2=A0 match Netsys.getpeername =
s with</font></div><div><font face=3D"courier new, monospace">3137,3138d313=
6</font></div><div><font face=3D"courier new, monospace">&lt; =C2=A0 with U=
nix.Unix_error (Unix.EAFNOSUPPORT, _, _)</font></div>
<div><font face=3D"courier new, monospace">&lt; =C2=A0 =C2=A0 `Sock_unix(st=
ype, &quot;&quot;)</font></div><div><font face=3D"courier new, monospace">3=
143c3141</font></div><div><font face=3D"courier new, monospace">&lt; =C2=A0=
 try match Netsys.getpeername s with</font></div>
<div><font face=3D"courier new, monospace">---</font></div><div><font face=
=3D"courier new, monospace">&gt; =C2=A0 match Netsys.getpeername s with</fo=
nt></div><div><font face=3D"courier new, monospace">3148,3149d3145</font></=
div><div>
<font face=3D"courier new, monospace">&lt; =C2=A0 with Unix.Unix_error (Uni=
x.EAFNOSUPPORT, _, _)</font></div><div><font face=3D"courier new, monospace=
">&lt; <span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>Non=
e</font></div>
<div><br></div><br><div class=3D"gmail_quote">On Wed, Sep 26, 2012 at 9:15 =
PM, Mat=C3=ADas Giovannini <span dir=3D"ltr">&lt;<a href=3D"mailto:mgiovann=
@gmail.com" target=3D"_blank">[email protected]</a>&gt;</span> wrote:<br><=
blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px=
 #ccc solid;padding-left:1ex">
Hi,<div><br></div><div>I send out in the hopes that, despite the ancient so=
ftware and platform I&#39;m having problems with, someone could shed some l=
ight on this. Currently netplex is broken on this machine, failing with err=
ors of the following sort:</div>

<div><br></div><div><div>fd style: Recv_send_implied</div><div>fd style: Re=
cv_send_implied</div><div>Netplex Catastrophic Error: Unable to send log me=
ssage - exception Rpc_client.Communication_error(File &quot;<a href=3D"http=
://uq_engines.ml" target=3D"_blank">uq_engines.ml</a>&quot;, line 2576, cha=
racters 6-12: Assertion failed)</div>

<div>Log message is: poll: Exception Rpc_client.Communication_error(File &q=
uot;<a href=3D"http://uq_engines.ml" target=3D"_blank">uq_engines.ml</a>&qu=
ot;, line 2576, characters 6-12: Assertion failed)</div><div>[Wed Sep 26 21=
:10:39 2012] [netplex.controller] [alert] Disabling service after 10 startu=
p failures</div>

</div><div><br></div><div>(the &quot;fd_style&quot; line is a strategically=
 placed print statement). I am at a loss in following <a href=3D"http://uq_=
engines.ml" target=3D"_blank">uq_engines.ml</a>, so I don&#39;t know where =
to look.</div>
<div>
<br></div><div>I configured ocamlnet with:</div><div><br></div><div>./confi=
gure -with-nethttpd -enable-zip -disable-tcl -prefer-netcgi2 -enable-pcre</=
div><div><br></div><div>and the result is:</div><div><br></div><div><div>

able-tcl -prefer-netcgi2 -enable-pcre</div><div>Welcome to Ocamlnet version=
 3.6</div><div>Checking operating system... Generic</div><div>Checking for =
findlib... found</div><div>Checking multi-threading support... posix (ok)</=
div>

<div>Checking word size... 32 bit</div><div>Checking endianess... big</div>=
<div>Checking for GPROF... found</div><div>Checking for PCRE... found</div>=
<div>Checking for win32... no</div><div>Checking whether Ocaml has Printexc=
.register_printer... found</div>

<div>Checking for POSIX pthread... found</div><div>Checking whether Ocaml h=
as fancy page tables... found</div><div>Checking for POSIX shared memory...=
 found</div><div>Checking for POSIX semaphores (anonymous)... not found</di=
v>

<div>Checking for POSIX semaphores (named)... found</div><div>Checking for =
POSIX spawn... not found</div><div>Checking for POSIX fadvise... not found<=
/div><div>Checking for POSIX fallocate... not found</div><div>Checking for =
POSIX memalign... not found</div>

<div>Checking for syslog... found</div><div>Checking for POSIX functions li=
ke openat... not found</div><div>Checking for fchdir... found</div><div>Che=
cking for fdopendir... not found</div><div>Checking for realpath... not fou=
nd</div>

<div>Checking for grantpt (System V style PTYs)... found</div><div>Checking=
 for posix_openpt (System V style PTYs)... found</div><div>Checking for ini=
tgroups...found</div><div>Checking for POSIX clocks...not found</div><div>

Checking for POSIX timers...not found</div><div>Checking for eventfd (Linux=
)...not found</div><div>Checking for timerfd (Linux)...not found</div><div>=
Checking for epoll (Linux)...not found</div><div>Checking for compare_and_s=
wap (GCC)...not found</div>

<div>Checking for GPROF... found</div><div>Checking for O_SHARE_DELETE... y=
es</div><div>Checking for getpeereid... found</div><div>Checking for getpee=
rucred... not found</div><div>Checking for camlzip... found</div><div>
Preprocessor for ocamlrpcgen: cpp</div>
<div><br></div><div>Effective options:</div><div>=C2=A0 =C2=A0 -enable-pcre=
</div><div>=C2=A0 =C2=A0 -disable-gtk</div><div>=C2=A0 =C2=A0 -disable-gtk2=
</div><div>=C2=A0 =C2=A0 -disable-tcl</div><div>=C2=A0 =C2=A0 -disable-ssl<=
/div><div>=C2=A0 =C2=A0 -enable-zip</div><div>=C2=A0 =C2=A0 -disable-crypto=
</div>

<div>=C2=A0 =C2=A0 -disable-apache</div><div>=C2=A0 =C2=A0 -with-nethttpd</=
div><div>=C2=A0 =C2=A0 -without-rpc-auth-dh</div><div>=C2=A0 =C2=A0 -bindir=
 /opt/ocaml/bin</div><div>=C2=A0 =C2=A0 -datadir /opt/ocaml/lib/site-lib/ne=
tstring</div><div>=C2=A0 =C2=A0 -cpp cpp</div></div><div>

<br></div><div>uname -a is &quot;Darwin Blue.local 8.11.0 Darwin Kernel Ver=
sion 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC=
 Power Macintosh powerpc&quot;,=C2=A0ocaml -version is &quot;The OCaml topl=
evel, version 4.00.0&quot; and=C2=A0gcc --version gives:</div>

<div><br></div><div>powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Comp=
uter, Inc. build 5370)</div><div>Copyright (C) 2005 Free Software Foundatio=
n, Inc.</div><div>This is free software; see the source for copying conditi=
ons. =C2=A0There is NO</div>

<div>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR=
POSE.</div><div><br></div><div>(prehistoric, I know). If anyone has any ide=
as, I&#39;d be grateful (except for suggestions to run Linux! ;-)</div>

<div><br></div><div>Best regards,</div><div>Mat=C3=ADas.</div>
</blockquote></div><br></div>

--20cf3005144aaacd9904cac870bf--


--===============7296778514222541166==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
--===============7296778514222541166==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ocamlnet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel

--===============7296778514222541166==--