[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#526442: libperl4caml-ocaml-dev: Can't use threads with www_mechanize

Package: libperl4caml-ocaml-dev
Version: 0.9.5-2
Severity: important

Here is a simple piece of code which dies with a segfault.

--------------- main.ml ---------------
let mech = Pl_WWW_Mechanize.new_ ()
let m = Mutex.create ()

let evil_thread () =
  Mutex.lock m;
  mech#get "http://www.debian.org";;
  Mutex.unlock m

let _ =
  Mutex.lock m;
  mech#agent_alias "Linux Mozilla";
  mech#get "http://www.gnu.org";;
  Mutex.unlock m;
  let _ = Thread.create evil_thread () in
  Mutex.lock m;
  print_string mech#content;
  Mutex.unlock m

To make the .byte :
ocamlbuild -libs unix,perl4caml,threads -cflags -I,+perl,-I,+threads -lflags \
-I,/usr/lib/ocaml/3.11.0/perl/,-I,/usr/lib/ocaml/3.11.0/threads/ main.native

same problem with the .native version

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.29-1-amd64
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libperl4caml-ocaml-dev depends on:
ii  libdate-calc-perl            5.4-6       Perl library for accessing dates
ii  libhtml-tree-perl            3.23-1      represent and create HTML syntax t
ii  libnet-google-perl           1.0.1-1     Simple OOP-ish interface to the Go
ii  libperl4caml-ocaml           0.9.5-2     Use Perl code in OCaml programs, r
ii  libtemplate-perl             2.20-1      template processing system written
ii  liburi-perl                  1.37+dfsg-1 Manipulates and accesses URI strin

libperl4caml-ocaml-dev recommends no packages.

Versions of packages libperl4caml-ocaml-dev suggests:
ii  libcrypt-ssleay-perl          0.57-1+b1  Support for https protocol in LWP
ii  libperl4caml-ocaml-doc        0.9.5-2    Use Perl code in OCaml programs, d
ii  libtimedate-perl              1.1600-9   Time and date functions for Perl
ii  libwww-mechanize-perl         1.54-2     module to automate interaction wit
ii  libwww-perl                   5.825-1    WWW client/server library for Perl

-- no debconf information

Reply to: