caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] segfault in Unix.gethostbyname
@ 2004-03-26 18:22 Kenneth Knowles
  2004-03-26 18:30 ` Thomas Fischbacher
  2004-03-26 19:00 ` Blair Zajac
  0 siblings, 2 replies; 5+ messages in thread
From: Kenneth Knowles @ 2004-03-26 18:22 UTC (permalink / raw)
  To: caml-list

Hi all,

I get a segfault from Unix.gethostbyname whenever I have wins enabled in my
nsswitch.conf, but with wins removed everything is fine.  I'm hoping someone
with more unix/ocaml-C experience will have a clue.  This was actually working a
week ago, but I had to "flatten and reinstall" my system.

$ grep wins /etc/nsswitch.conf
hosts:       files wins dns 

$ gdb ocamlrun
(gdb) run /usr/local/bin/ocaml unix.cma
Starting program: /usr/local/bin/ocamlrun /usr/local/bin/ocaml unix.cma
        Objective Caml version 3.07+2

# Unix.gethostbyname "dbdev";;

Program received signal SIGSEGV, Segmentation fault.
0x080536c3 in string_set ()
(gdb) bt
#0  0x080536c3 in string_set ()
#1  0x4034b971 in _nss_wins_gethostbyname2_r () from /lib/libnss_wins.so.2
#2  0x403cb42c in bLoaded () from /lib/libnss_wins.so.2
#3  0x4039bb5b in ?? () from /lib/libnss_wins.so.2
#4  0x00000294 in ?? ()

Now I can see it is some kind of string error, and it occurs in the WINS
library, but I'm sure it traces back somehow to the ocaml String_val(..)

On my system, WINS has no other problems (ping, samba sharing, etc):

$ ping dbdev
PING dbdev (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=128 time=28.5 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=128 time=28.0 ms


Any ideas what could cause this?  I'm about to dive into the winbind code for
clues but that sounds awful.  It is samba 3.02a (also with samba 2.2.8) and
ocaml 3.07+2

Kenn

p.s.  This was a pain to track down because it first showed up as a segfault in
my binding to the FreeTDS library and I figured I had just made any of a million
possible mistakes in C.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] segfault in Unix.gethostbyname
  2004-03-26 18:22 [Caml-list] segfault in Unix.gethostbyname Kenneth Knowles
@ 2004-03-26 18:30 ` Thomas Fischbacher
  2004-03-26 19:24   ` Kenneth Knowles
  2004-03-26 19:00 ` Blair Zajac
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Fischbacher @ 2004-03-26 18:30 UTC (permalink / raw)
  To: Kenneth Knowles; +Cc: caml-list


On Fri, 26 Mar 2004, Kenneth Knowles wrote:

> Now I can see it is some kind of string error, and it occurs in the WINS
> library, but I'm sure it traces back somehow to the ocaml String_val(..)

Hm. Have you had a look at ltrace output?

-- 
regards,               tf@cip.physik.uni-muenchen.de              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] segfault in Unix.gethostbyname
  2004-03-26 18:22 [Caml-list] segfault in Unix.gethostbyname Kenneth Knowles
  2004-03-26 18:30 ` Thomas Fischbacher
@ 2004-03-26 19:00 ` Blair Zajac
  2004-03-26 19:27   ` Kenneth Knowles
  1 sibling, 1 reply; 5+ messages in thread
From: Blair Zajac @ 2004-03-26 19:00 UTC (permalink / raw)
  To: Kenneth Knowles; +Cc: caml-list

Kenneth Knowles wrote:
> 
> Hi all,
> 
> I get a segfault from Unix.gethostbyname whenever I have wins enabled in my
> nsswitch.conf, but with wins removed everything is fine.  I'm hoping someone
> with more unix/ocaml-C experience will have a clue.  This was actually working a
> week ago, but I had to "flatten and reinstall" my system.
> 
> $ grep wins /etc/nsswitch.conf
> hosts:       files wins dns
> 
> $ gdb ocamlrun
> (gdb) run /usr/local/bin/ocaml unix.cma
> Starting program: /usr/local/bin/ocamlrun /usr/local/bin/ocaml unix.cma
>         Objective Caml version 3.07+2
> 
> # Unix.gethostbyname "dbdev";;
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x080536c3 in string_set ()
> (gdb) bt
> #0  0x080536c3 in string_set ()
> #1  0x4034b971 in _nss_wins_gethostbyname2_r () from /lib/libnss_wins.so.2
> #2  0x403cb42c in bLoaded () from /lib/libnss_wins.so.2
> #3  0x4039bb5b in ?? () from /lib/libnss_wins.so.2
> #4  0x00000294 in ?? ()
> 
> Now I can see it is some kind of string error, and it occurs in the WINS
> library, but I'm sure it traces back somehow to the ocaml String_val(..)

I believe you're running into a problem where the Samba code is binding
to the string_set symbol in Ocaml and not in the Samba library.  You'll
find a string_set in Ocaml's byterun/str.c.

Probably the easiest solution is to get CVS HEAD of ocaml which has renamed
many function names to have "caml_" prepended, thus avoiding this issue.

Best,
Blair

-- 
Blair Zajac <blair@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] segfault in Unix.gethostbyname
  2004-03-26 18:30 ` Thomas Fischbacher
@ 2004-03-26 19:24   ` Kenneth Knowles
  0 siblings, 0 replies; 5+ messages in thread
From: Kenneth Knowles @ 2004-03-26 19:24 UTC (permalink / raw)
  To: Thomas Fischbacher; +Cc: caml-list


> Hm. Have you had a look at ltrace output?

I have now, but I'm not really familiar with ltrace, and I'm not sure how to
interpret it...

kenn@tallman gethost $ ltrace -l /lib/libnss_wins.so.2 ocamlrun ocaml unix.cma
        Objective Caml version 3.07+2

# Unix.gethostbyname "dbdev";;
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

There is no output, but isn't that contradictory with where gdb finds the
segfault?

Without the -l option, the last few lines look like this (there's way too much
memmove stuff to paste):

  free(0x809ba38)                                                  = <void>
  free(0x80a14a0)                                                  = <void>
  malloc(28)                                                       = 0x8092698
  memmove(0x08092698, 0x401dcfe0, 28, 0x08059747, 28)              = 0x08092698
  malloc(6)                                                        = 0x80926b8
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++


I'm not sure what this signifies.

Kenn

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] segfault in Unix.gethostbyname
  2004-03-26 19:00 ` Blair Zajac
@ 2004-03-26 19:27   ` Kenneth Knowles
  0 siblings, 0 replies; 5+ messages in thread
From: Kenneth Knowles @ 2004-03-26 19:27 UTC (permalink / raw)
  To: Blair Zajac; +Cc: caml-list


Aha, I remember that discussion.  Before my reinstall I had the CVS of ocaml,
and this time I'm using a release.  I didn't realize that fix wasn't in the new
releases (have been using CVS version for a long time).

Thanks a bunch.

Kenn

On Fri, Mar 26, 2004 at 11:00:03AM -0800, Blair Zajac wrote:
> Kenneth Knowles wrote:
> > 
> > Hi all,
> > 
> > I get a segfault from Unix.gethostbyname whenever I have wins enabled in my
> > nsswitch.conf, but with wins removed everything is fine.  I'm hoping someone
> > with more unix/ocaml-C experience will have a clue.  This was actually working a
> > week ago, but I had to "flatten and reinstall" my system.
> > 
> > $ grep wins /etc/nsswitch.conf
> > hosts:       files wins dns
> > 
> > $ gdb ocamlrun
> > (gdb) run /usr/local/bin/ocaml unix.cma
> > Starting program: /usr/local/bin/ocamlrun /usr/local/bin/ocaml unix.cma
> >         Objective Caml version 3.07+2
> > 
> > # Unix.gethostbyname "dbdev";;
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x080536c3 in string_set ()
> > (gdb) bt
> > #0  0x080536c3 in string_set ()
> > #1  0x4034b971 in _nss_wins_gethostbyname2_r () from /lib/libnss_wins.so.2
> > #2  0x403cb42c in bLoaded () from /lib/libnss_wins.so.2
> > #3  0x4039bb5b in ?? () from /lib/libnss_wins.so.2
> > #4  0x00000294 in ?? ()
> > 
> > Now I can see it is some kind of string error, and it occurs in the WINS
> > library, but I'm sure it traces back somehow to the ocaml String_val(..)
> 
> I believe you're running into a problem where the Samba code is binding
> to the string_set symbol in Ocaml and not in the Samba library.  You'll
> find a string_set in Ocaml's byterun/str.c.
> 
> Probably the easiest solution is to get CVS HEAD of ocaml which has renamed
> many function names to have "caml_" prepended, thus avoiding this issue.
> 
> Best,
> Blair
> 
> -- 
> Blair Zajac <blair@orcaware.com>
> Plots of your system's performance - http://www.orcaware.com/orca/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-03-26 19:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-26 18:22 [Caml-list] segfault in Unix.gethostbyname Kenneth Knowles
2004-03-26 18:30 ` Thomas Fischbacher
2004-03-26 19:24   ` Kenneth Knowles
2004-03-26 19:00 ` Blair Zajac
2004-03-26 19:27   ` Kenneth Knowles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).