From Richard.Mortier@nottingham.ac.uk Tue Nov 01 18:26:58 2011
Received: from ppsw-51.csi.cam.ac.uk ([131.111.8.151])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RLJ34-0006gQ-8g (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Tue, 01 Nov 2011 18:26:58 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195374 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from thb-mta-19-tx.emailfiltering.com ([194.116.199.150]:38898
	helo=thb-mta-19.emailfiltering.com)
	by ppsw-51.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.148]:25)
	with esmtp (csa=unknown) id 1RLJ2y-0008Fq-Y9 (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Tue, 01 Nov 2011 18:26:58 +0000
Received: from smtp1.nottingham.ac.uk ([128.243.44.4])
	by thb-mta-19.emailfiltering.com with emfmta (version 4.8.5.36) vanilla
	id 2174443734 for cl-mirage@lists.cam.ac.uk; 4f13af5089899640;
	Tue, 01 Nov 2011 18:26:32 +0000
Received: from uiwexhub02.ad.nottingham.ac.uk ([128.243.15.132])
	by smtp1.nottingham.ac.uk with esmtp (Exim 4.60)
	(envelope-from <Richard.Mortier@nottingham.ac.uk>)
	id 1RLJ2e-0002bB-6K
	for cl-mirage@lists.cam.ac.uk; Tue, 01 Nov 2011 18:26:32 +0000
Received: from EXCHANGE1.ad.nottingham.ac.uk ([fe80::7962:f868:e6ee:6267]) by
	UIWEXHUB02.ad.nottingham.ac.uk ([2002:80f3:f84::80f3:f84]) with mapi;
	Tue, 1 Nov 2011 18:27:40 +0000
From: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
To: Anil Madhavapeddy <anil@recoil.org>
Date: Tue, 1 Nov 2011 18:26:30 +0000
Subject: sockets exn- one day i'll learn to put things down
Thread-Topic: sockets exn- one day i'll learn to put things down
Thread-Index: AcyYw++ShziGenztSdykVUqtLqU4OQ==
Message-ID: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
Accept-Language: en-US, en-GB
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US, en-GB
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Tue, 01 Nov 2011 18:26:58 -0000
X-Keywords:                  
X-UID: 122
Status: O
Content-Length: 3673
Lines: 90

ok- so i patently failed to get on and do some real work.  instead, continu=
ed blundering my way through figuring out this occasional exception.  this =
is something of a brain dump.

[[ cl-mirage: ocaml gods welcome to look at this! :)  i've no real idea wha=
t i'm doing.  symptom is that, when running the mirage-tutorial on unix -- =
osx to be precise -- after "some" page reloads, it fails with a fatal error=
 indicating an uncaught exception:

Fatal error: exception Invalid_argument("Lwt.wakeup")

...any hints welcome; roughly how far i've managed to get is below...
]]

1/ looks like cut'n'paste of c code unnecessary to get backtraces- followin=
g patch appears to dtrt in terms of printing backtrace:

"""
: mort@greyjay:mirage.git$; git diff lib/os/unix/main.ml
diff --git a/lib/os/unix/main.ml b/lib/os/unix/main.ml
index 488d722..973d3ff 100644
--- a/lib/os/unix/main.ml
+++ b/lib/os/unix/main.ml
@@ -69,6 +69,7 @@ let run t =3D
   in
   (* Register a callback for the JS runtime to restart this function *)
   let _ =3D Callback.register "Main.run" fn in
+  Printexc.record_backtrace true;
   fn ()
=20
 let () =3D at_exit (fun () -> run (call_hooks exit_hooks))
"""
... unless you know of a reason why that actually gives plausible looking g=
arbage?

2/ my current impression is that we're waking up a thread that isn't actual=
ly asleep.  i'm basically clueless here - the exception appears to be being=
 thrown somewhere in std/format.ml and/or std/lwt.ml, eg.,

"""
[00009] 2011/10/01T16:33:32Z  info               Server: /slides.js (backtr=
ace: Raised at file "net/socket/channel.ml", line 129, characters 16-121
)
Fatal error: exception Invalid_argument("Lwt.wakeup")
Raised at file "std/format.ml", line 195, characters 15-26
Called from file "std/format.ml", line 421, characters 8-33
Called from file "std/format.ml", line 436, characters 6-24
Called from file "std/lwt.ml", line 427, characters 66-71
Re-raised at file "std/lwt.ml", line 485, characters 33-36
Called from file "std/lwt.ml", line 147, characters 2-34
Called from file "std/lwt.ml", line 147, characters 2-34
...many many repeats of line above...
Called from file "std/lwt.ml", line 147, characters 2-34
Called from file "std/lwt.ml", line 130, characters 8-15
Called from file "std/lwt.ml", line 147, characters 2-34
make: *** [run-socket_fs] Error 2
"""

the exn in channel.ml is the Closed exn raised to indicate file closure, an=
d correctly handled.

the exn in format.ml appears to come from parsing the format string, possib=
ly reaching the end.

after adding some extra debug output, the exn in lwt.ml is trying to wakup =
a thread that's already in state "Return"

any suggestions?

3/ in general, is there a well-known good setup for debugging this stuff?  =
useful compiler flags?  useful pretty printer functions for getting state o=
ut on the console?
--=20
Cheers,

R.

=
This message and any attachment are intended solely for the addressee a=
nd may contain confidential information. If you have received this mess=
age in error, please send it back to me, and immediately delete it.   P=
lease do not use, copy or disclose the information contained in this me=
ssage or in any attachment.  Any views or opinions expressed by the aut=
hor of this email do not necessarily reflect the views of the Universit=
y of Nottingham.=0D=0A=0D=0AThis message has been checked for viruses b=
ut the contents of an attachment=0D=0Amay still contain software viruse=
s which could damage your computer system:=0D=0Ayou are advised to perf=
orm your own checks. Email communications with the=0D=0AUniversity of N=
ottingham may be monitored as permitted by UK legislation.=


From anil@recoil.org Tue Nov 01 18:42:14 2011
Received: from ppsw-52.csi.cam.ac.uk ([131.111.8.152])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RLJHq-0007IG-2t (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Tue, 01 Nov 2011 18:42:14 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195374 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from recoil.dh.bytemark.co.uk ([89.16.177.154]:32772
	helo=dark.recoil.org)
	by ppsw-52.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.149]:25)
	with smtp (csa=unknown) id 1RLJHp-0003LI-Eq (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Tue, 01 Nov 2011 18:42:14 +0000
Received: (qmail 25360 invoked by uid 634); 1 Nov 2011 18:42:13 -0000
X-Spam-Level: *
X-Spam-Status: No, hits=-1.4 required=5.0
	tests=ALL_TRUSTED
X-Spam-Check-By: dark.recoil.org
Received: from freak-0.srg.cl.cam.ac.uk (HELO freak-0.srg.cl.cam.ac.uk)
	(128.232.32.220)
	(smtp-auth username remote@recoil.org, mechanism cram-md5)
	by dark.recoil.org (qpsmtpd/0.83) with ESMTPA;
	Tue, 01 Nov 2011 18:42:11 +0000
Subject: Re: sockets exn- one day i'll learn to put things down
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset=us-ascii
From: Anil Madhavapeddy <anil@recoil.org>
In-Reply-To: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
Date: Tue, 1 Nov 2011 18:42:10 +0000
Content-Transfer-Encoding: quoted-printable
Message-Id: <7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
References: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
To: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
X-Mailer: Apple Mail (2.1251.1)
X-Virus-Checked: Checked by ClamAV on dark.recoil.org
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Tue, 01 Nov 2011 18:42:14 -0000
X-Keywords:                  
X-UID: 123
Status: O
Content-Length: 4875
Lines: 123

Firstly, lets add the record backtrace to the main function; very =
useful!

On the Lwt front, you are hitting the fact that the backtrace is lost =
between threads due to the Lwt monad. However, the pa_lwt syntax =
extension has an option to preserve the backtrace.  I haven't turned =
this on due to a certain difficulty with figuring out how to make it =
optional in ocamlbuild.=20

However, I could just turn it on permanently, with us remembering to =
turn it off when doing performance tests for production runs, where =
thread backtrace recording may be too expensive.

Any objections to that?

On the general topic of debugging, what we really need is an interactive =
toplevel. Lwt itself has a fantastic one if you install the Debian =
package (lwt-toplevel) which could let you inspect the state of threads =
as it runs.  This is something that could be ported to Mirage at some =
point... there's even a native code version of the toplevel now, so the =
Xen backend could get in on the party too!

Anil

On 1 Nov 2011, at 18:26, Richard Mortier wrote:

> ok- so i patently failed to get on and do some real work.  instead, =
continued blundering my way through figuring out this occasional =
exception.  this is something of a brain dump.
>=20
> [[ cl-mirage: ocaml gods welcome to look at this! :)  i've no real =
idea what i'm doing.  symptom is that, when running the mirage-tutorial =
on unix -- osx to be precise -- after "some" page reloads, it fails with =
a fatal error indicating an uncaught exception:
>=20
> Fatal error: exception Invalid_argument("Lwt.wakeup")
>=20
> ...any hints welcome; roughly how far i've managed to get is below...
> ]]
>=20
> 1/ looks like cut'n'paste of c code unnecessary to get backtraces- =
following patch appears to dtrt in terms of printing backtrace:
>=20
> """
> : mort@greyjay:mirage.git$; git diff lib/os/unix/main.ml
> diff --git a/lib/os/unix/main.ml b/lib/os/unix/main.ml
> index 488d722..973d3ff 100644
> --- a/lib/os/unix/main.ml
> +++ b/lib/os/unix/main.ml
> @@ -69,6 +69,7 @@ let run t =3D
>   in
>   (* Register a callback for the JS runtime to restart this function =
*)
>   let _ =3D Callback.register "Main.run" fn in
> +  Printexc.record_backtrace true;
>   fn ()
>=20
> let () =3D at_exit (fun () -> run (call_hooks exit_hooks))
> """
> ... unless you know of a reason why that actually gives plausible =
looking garbage?
>=20
> 2/ my current impression is that we're waking up a thread that isn't =
actually asleep.  i'm basically clueless here - the exception appears to =
be being thrown somewhere in std/format.ml and/or std/lwt.ml, eg.,
>=20
> """
> [00009] 2011/10/01T16:33:32Z  info               Server: /slides.js =
(backtrace: Raised at file "net/socket/channel.ml", line 129, characters =
16-121
> )
> Fatal error: exception Invalid_argument("Lwt.wakeup")
> Raised at file "std/format.ml", line 195, characters 15-26
> Called from file "std/format.ml", line 421, characters 8-33
> Called from file "std/format.ml", line 436, characters 6-24
> Called from file "std/lwt.ml", line 427, characters 66-71
> Re-raised at file "std/lwt.ml", line 485, characters 33-36
> Called from file "std/lwt.ml", line 147, characters 2-34
> Called from file "std/lwt.ml", line 147, characters 2-34
> ...many many repeats of line above...
> Called from file "std/lwt.ml", line 147, characters 2-34
> Called from file "std/lwt.ml", line 130, characters 8-15
> Called from file "std/lwt.ml", line 147, characters 2-34
> make: *** [run-socket_fs] Error 2
> """
>=20
> the exn in channel.ml is the Closed exn raised to indicate file =
closure, and correctly handled.
>=20
> the exn in format.ml appears to come from parsing the format string, =
possibly reaching the end.
>=20
> after adding some extra debug output, the exn in lwt.ml is trying to =
wakup a thread that's already in state "Return"
>=20
> any suggestions?
>=20
> 3/ in general, is there a well-known good setup for debugging this =
stuff?  useful compiler flags?  useful pretty printer functions for =
getting state out on the console?
> --=20
> Cheers,
>=20
> R.
>=20
> This message and any attachment are intended solely for the addressee =
and may contain confidential information. If you have received this =
message in error, please send it back to me, and immediately delete it.  =
 Please do not use, copy or disclose the information contained in this =
message or in any attachment.  Any views or opinions expressed by the =
author of this email do not necessarily reflect the views of the =
University of Nottingham.
>=20
> This message has been checked for viruses but the contents of an =
attachment
> may still contain software viruses which could damage your computer =
system:
> you are advised to perform your own checks. Email communications with =
the
> University of Nottingham may be monitored as permitted by UK =
legislation.



From jac22@cl.cam.ac.uk Wed Nov 02 12:43:14 2011
Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RLa9y-0005ri-K9 (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <jac22@cl.cam.ac.uk>); Wed, 02 Nov 2011 12:43:14 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -4.1 from SpamAssassin-3.3.2-1195874 
	* -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
	* -1.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay
	*      domain
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from mta1.cl.cam.ac.uk ([128.232.25.21]:43124)
	by ppsw-50.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.147]:25)
	with esmtp id 1RLa9y-0000Sx-py (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <jac22@cl.cam.ac.uk>); Wed, 02 Nov 2011 12:43:14 +0000
Received: from ramsey.cl.cam.ac.uk ([128.232.1.219] helo=cl.cam.ac.uk)
	by mta1.cl.cam.ac.uk with esmtp (Exim 4.63)
	(envelope-from <jac22@cl.cam.ac.uk>) id 1RLa9y-0002Op-2p
	for cl-mirage@lists.cam.ac.uk; Wed, 02 Nov 2011 12:43:14 +0000
To: Mirage List <cl-mirage@lists.cam.ac.uk>
Subject: not very mirage but related
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <30706.1320237791.1@cl.cam.ac.uk>
Date: Wed, 02 Nov 2011 12:43:11 +0000
From: Jon Crowcroft <Jon.Crowcroft@cl.cam.ac.uk>
Message-Id: <E1RLa9y-0002Op-2p@mta1.cl.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 02 Nov 2011 12:43:14 -0000
X-Keywords:                  
X-UID: 124
Status: O
Content-Length: 267
Lines: 13

i really like this paper
Darjeeling, a feature-rich VM for the resource poor
Niels Brouwers, Koen Langendoen, Peter Corke

http://dl.acm.org/citation.cfm?id=1644056
or
http://www.scribd.com/doc/46320830/2009-Brouwers-darjeeling

seems not unrelated somehow

   jon



From anil@recoil.org Wed Nov 02 13:09:59 2011
Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RLaZr-0006qn-AC (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Wed, 02 Nov 2011 13:09:59 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from recoil.dh.bytemark.co.uk ([89.16.177.154]:35914
	helo=dark.recoil.org)
	by ppsw-41.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.146]:25)
	with smtp (csa=unknown) id 1RLaZq-00086E-Qb (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Wed, 02 Nov 2011 13:09:58 +0000
Received: (qmail 329 invoked by uid 634); 2 Nov 2011 13:09:57 -0000
X-Spam-Level: *
X-Spam-Status: No, hits=-1.4 required=5.0
	tests=ALL_TRUSTED
X-Spam-Check-By: dark.recoil.org
Received: from freak-0.srg.cl.cam.ac.uk (HELO freak-0.srg.cl.cam.ac.uk)
	(128.232.32.220)
	(smtp-auth username remote@recoil.org, mechanism cram-md5)
	by dark.recoil.org (qpsmtpd/0.83) with ESMTPA;
	Wed, 02 Nov 2011 13:09:57 +0000
Subject: Re: not very mirage but related
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset=us-ascii
From: Anil Madhavapeddy <anil@recoil.org>
In-Reply-To: <E1RLa9y-0002Op-2p@mta1.cl.cam.ac.uk>
Date: Wed, 2 Nov 2011 13:09:56 +0000
Content-Transfer-Encoding: quoted-printable
Message-Id: <7CB7157D-DCA3-4FBD-808F-B371D7DFFDBF@recoil.org>
References: <E1RLa9y-0002Op-2p@mta1.cl.cam.ac.uk>
To: Jon Crowcroft <Jon.Crowcroft@cl.cam.ac.uk>
X-Mailer: Apple Mail (2.1251.1)
X-Virus-Checked: Checked by ClamAV on dark.recoil.org
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 02 Nov 2011 13:09:59 -0000
X-Keywords:                  
X-UID: 125
Status: O
Content-Length: 733
Lines: 27

Very neat! There's an OCaml project with similar goals:
http://www.algo-prog.info/ocapic/web/index.php?id=3Docapic

Runs the OCaml VM on a 16-bit PIC, nearly unmodified code. I've actually =
got a half-finished tree that integrates its deadcode elimination into =
Mirage, so our microkernels also benefit... will post that next week =
after I finish some other paper work!

Anil

On 2 Nov 2011, at 12:43, Jon Crowcroft wrote:

> i really like this paper
> Darjeeling, a feature-rich VM for the resource poor
> Niels Brouwers, Koen Langendoen, Peter Corke
>=20
> http://dl.acm.org/citation.cfm?id=3D1644056
> or
> http://www.scribd.com/doc/46320830/2009-Brouwers-darjeeling
>=20
> seems not unrelated somehow
>=20
>   jon
>=20
>=20



From Richard.Mortier@nottingham.ac.uk Wed Nov 02 17:25:09 2011
Received: from ppsw-52.csi.cam.ac.uk ([131.111.8.152])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RLeYn-0003h1-O9 (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Wed, 02 Nov 2011 17:25:09 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from ixe-mta-19-tx.emailfiltering.com ([194.116.198.150]:53092
	helo=ixe-mta-19.emailfiltering.com)
	by ppsw-52.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.149]:25)
	with esmtp (csa=unknown) id 1RLeYh-0008Fh-DC (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Wed, 02 Nov 2011 17:25:09 +0000
Received: from smtp2.nottingham.ac.uk ([128.243.44.5])
	by ixe-mta-19.emailfiltering.com with emfmta (version 4.8.5.36) vanilla
	id 2023499756 for cl-mirage@lists.cam.ac.uk; 4b6a9c9d6f1bef98;
	Wed, 02 Nov 2011 17:24:42 +0000
Received: from uiwexhub01.ad.nottingham.ac.uk ([128.243.15.133])
	by smtp2.nottingham.ac.uk with esmtp (Exim 4.60)
	(envelope-from <Richard.Mortier@nottingham.ac.uk>)
	id 1RLeYM-0000Ei-PB
	for cl-mirage@lists.cam.ac.uk; Wed, 02 Nov 2011 17:24:42 +0000
Received: from EXCHANGE1.ad.nottingham.ac.uk ([fe80::7962:f868:e6ee:6267]) by
	UIWEXHUB01.ad.nottingham.ac.uk ([2002:80f3:f85::80f3:f85]) with mapi;
	Wed, 2 Nov 2011 17:25:50 +0000
From: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
To: Anil Madhavapeddy <anil@recoil.org>
Date: Wed, 2 Nov 2011 17:24:41 +0000
Subject: Re: sockets exn- one day i'll learn to put things down
Thread-Topic: sockets exn- one day i'll learn to put things down
Thread-Index: AcyZhHb4o1mdFD0vQdCNTEfKq6R89A==
Message-ID: <BC9CE1FC-4F05-4D09-9F49-5090313249DA@nottingham.ac.uk>
References: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
	<7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
In-Reply-To: <7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
Accept-Language: en-US, en-GB
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US, en-GB
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 02 Nov 2011 17:25:09 -0000
X-Keywords:                  
X-UID: 126
Status: O
Content-Length: 2145
Lines: 48


On 1 Nov 2011, at 18:42, Anil Madhavapeddy wrote:

> Firstly, lets add the record backtrace to the main function; very useful!

pull request sent :)

> On the Lwt front, you are hitting the fact that the backtrace is lost bet=
ween threads due to the Lwt monad. However, the pa_lwt syntax extension has=
 an option to preserve the backtrace.  I haven't turned this on due to a ce=
rtain difficulty with figuring out how to make it optional in ocamlbuild.=20
>=20
> However, I could just turn it on permanently, with us remembering to turn=
 it off when doing performance tests for production runs, where thread back=
trace recording may be too expensive.
>=20
> Any objections to that?

aha. i have no objections - i'll start making use of that now anyway.  (pre=
sume you mean passing -lwt-debug to camlp4 as noted at <http://ocsigen.org/=
lwt/manual/> ?)

> On the general topic of debugging, what we really need is an interactive =
toplevel. Lwt itself has a fantastic one if you install the Debian package =
(lwt-toplevel) which could let you inspect the state of threads as it runs.=
  This is something that could be ported to Mirage at some point... there's=
 even a native code version of the toplevel now, so the Xen backend could g=
et in on the party too!

hm- perhaps a challenge for after ofelia tutorial is written :)
--=20
Cheers,

R.

=
This message and any attachment are intended solely for the addressee a=
nd may contain confidential information. If you have received this mess=
age in error, please send it back to me, and immediately delete it.   P=
lease do not use, copy or disclose the information contained in this me=
ssage or in any attachment.  Any views or opinions expressed by the aut=
hor of this email do not necessarily reflect the views of the Universit=
y of Nottingham.=0D=0A=0D=0AThis message has been checked for viruses b=
ut the contents of an attachment=0D=0Amay still contain software viruse=
s which could damage your computer system:=0D=0Ayou are advised to perf=
orm your own checks. Email communications with the=0D=0AUniversity of N=
ottingham may be monitored as permitted by UK legislation.=


From avsm@dark.recoil.org Fri Nov 04 09:40:05 2011
Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RMGFp-0006wc-5e (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <avsm@dark.recoil.org>); Fri, 04 Nov 2011 09:40:05 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from recoil.dh.bytemark.co.uk ([89.16.177.154]:13059
	helo=dark.recoil.org)
	by ppsw-50.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.147]:25)
	with smtp (csa=unknown) id 1RMGFn-0006d5-rK (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <avsm@dark.recoil.org>); Fri, 04 Nov 2011 09:40:05 +0000
Received: (qmail 16750 invoked by uid 10000); 4 Nov 2011 09:40:03 -0000
Date: Fri, 4 Nov 2011 09:40:03 +0000
From: Anil Madhavapeddy <anil@recoil.org>
To: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
Subject: Re: sockets exn- one day i'll learn to put things down
Message-ID: <20111104094003.GB10177@dark.recoil.org>
References: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
	<7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
	<BC9CE1FC-4F05-4D09-9F49-5090313249DA@nottingham.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <BC9CE1FC-4F05-4D09-9F49-5090313249DA@nottingham.ac.uk>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Fri, 04 Nov 2011 09:40:05 -0000
X-Keywords:                  
X-UID: 127
Status: O
Content-Length: 974
Lines: 24

On Wed, Nov 02, 2011 at 05:24:41PM +0000, Richard Mortier wrote:
> 
> > On the Lwt front, you are hitting the fact that the backtrace is lost
> > between threads due to the Lwt monad. However, the pa_lwt syntax
> > extension has an option to preserve the backtrace.  I haven't turned
> > this on due to a certain difficulty with figuring out how to make it
> > optional in ocamlbuild. 
> > 
> > However, I could just turn it on permanently, with us remembering to
> > turn it off when doing performance tests for production runs, where
> > thread backtrace recording may be too expensive.
> > 
> > Any objections to that?
> 
> aha. i have no objections - i'll start making use of that now anyway.
> (presume you mean passing -lwt-debug to camlp4 as noted at
> <http://ocsigen.org/lwt/manual/> ?)

Yeah. Did it work if you just manually add it to ocamlbuild? I've not had
a chance to try it yet.

-- 
Anil Madhavapeddy                                 http://anil.recoil.org


From Richard.Mortier@nottingham.ac.uk Fri Nov 04 21:19:26 2011
Received: from ppsw-51.csi.cam.ac.uk ([131.111.8.151])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RMRAc-0004mO-Ky (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Fri, 04 Nov 2011 21:19:26 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from thb-mta-19-tx.emailfiltering.com ([194.116.199.150]:55218
	helo=thb-mta-19.emailfiltering.com)
	by ppsw-51.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.148]:25)
	with esmtp (csa=unknown) id 1RMRAW-0001Ya-Ye (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Fri, 04 Nov 2011 21:19:26 +0000
Received: from smtp1.nottingham.ac.uk ([128.243.44.4])
	by thb-mta-19.emailfiltering.com with emfmta (version 4.8.5.36) vanilla
	id 2179228958 for cl-mirage@lists.cam.ac.uk; 610683950cbf499b;
	Fri, 04 Nov 2011 21:19:00 +0000
Received: from uiwexhub01.ad.nottingham.ac.uk ([128.243.15.133])
	by smtp1.nottingham.ac.uk with esmtp (Exim 4.60)
	(envelope-from <Richard.Mortier@nottingham.ac.uk>)
	id 1RMR92-0002Pn-AU
	for cl-mirage@lists.cam.ac.uk; Fri, 04 Nov 2011 21:17:48 +0000
Received: from EXCHANGE1.ad.nottingham.ac.uk ([fe80::7962:f868:e6ee:6267]) by
	UIWEXHUB01.ad.nottingham.ac.uk ([2002:80f3:f85::80f3:f85]) with mapi;
	Fri, 4 Nov 2011 21:17:52 +0000
From: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
To: Anil Madhavapeddy <anil@recoil.org>, Mirage List
	<cl-mirage@lists.cam.ac.uk>
Date: Fri, 4 Nov 2011 21:16:43 +0000
Subject: Re: sockets exn- one day i'll learn to put things down
Thread-Topic: sockets exn- one day i'll learn to put things down
Thread-Index: AcybNzXcWfQMgrSfTDCjKEdxwsUYjQ==
Message-ID: <D37EB03E-5A70-4753-BC89-33735D1D89F4@nottingham.ac.uk>
References: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
	<7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
	<BC9CE1FC-4F05-4D09-9F49-5090313249DA@nottingham.ac.uk>
	<20111104094003.GB10177@dark.recoil.org>
In-Reply-To: <20111104094003.GB10177@dark.recoil.org>
Accept-Language: en-US, en-GB
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US, en-GB
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Fri, 04 Nov 2011 21:19:26 -0000
X-Keywords:                  
X-UID: 128
Status: O
Content-Length: 3172
Lines: 87


On 4 Nov 2011, at 09:40, Anil Madhavapeddy wrote:

> On Wed, Nov 02, 2011 at 05:24:41PM +0000, Richard Mortier wrote:
>> aha. i have no objections - i'll start making use of that now anyway.
>> (presume you mean passing -lwt-debug to camlp4 as noted at
>> <http://ocsigen.org/lwt/manual/> ?)
>=20
> Yeah. Did it work if you just manually add it to ocamlbuild? I've not had
> a chance to try it yet.

i *think* so...  to summarise:

+ i've sent (or will send shortly) another pull req as i forgot to commit t=
he addition of "-g" to ocamlc commands (required to actually have the backt=
races filled in)

+ adding -lwt-debug to all builds changes the backtrace output i see to:

"""
Fatal error: exception Invalid_argument("Lwt.wakeup")
Raised at file "std/format.ml", line 195, characters 15-26
Called from file "std/format.ml", line 421, characters 8-33
Called from file "std/format.ml", line 436, characters 6-24
Called from file "std/lwt.ml", line 922, characters 66-71
Re-raised at file "net/socket/flow.ml", line 51, characters 2-287
Re-raised at file "std/lwt.ml", line 485, characters 33-36
Called from file "std/lwt.ml", line 147, characters 2-34
Called from file "std/lwt.ml", line 147, characters 2-34
...
"""

the reason i say "i think so" above is, surely i should see more detail tha=
n that with debugging turned on?  (though checking line numbers, it is the =
backtrace_* versions of lwt bind etc that are being called.)

+ anyway, investigating flow.ml around line 51 i see:

"""
let close t =3D
  R.close t.fd;
  Lwt.wakeup t.abort_u ();
  return ()

let close_on_exit t fn =3D
  try_lwt=20
    lwt x =3D fn t in
    close t=20
    >> return x
  with exn ->=20
    close t
    >> fail exn
"""

where line 51 is the "lwt x =3D ...".

now, that looks suspicious to me- if an exception is raised in the initial =
call of close then won't this attempt to wakeup the abort_u thread twice, l=
eading to the Lwt.wakeup exception observed? =20

unfortunately, commenting out the try/catch sections doesn't solve the prob=
lem, so i'll keep looking...  any hints welcome- i'm getting this crash suf=
ficiently frequently that i'd really prefer to fix it before the tutorial n=
ext week...

--=20
Cheers,

R.

i apologise for the rather long and pointless legalese that usually follows=
 - i have no control over this. it embarrasses me as much as it irritates y=
ou...

=
This message and any attachment are intended solely for the addressee a=
nd may contain confidential information. If you have received this mess=
age in error, please send it back to me, and immediately delete it.   P=
lease do not use, copy or disclose the information contained in this me=
ssage or in any attachment.  Any views or opinions expressed by the aut=
hor of this email do not necessarily reflect the views of the Universit=
y of Nottingham.=0D=0A=0D=0AThis message has been checked for viruses b=
ut the contents of an attachment=0D=0Amay still contain software viruse=
s which could damage your computer system:=0D=0Ayou are advised to perf=
orm your own checks. Email communications with the=0D=0AUniversity of N=
ottingham may be monitored as permitted by UK legislation.=


From anil@recoil.org Sat Nov 05 00:04:32 2011
Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RMTkO-0007QG-Fz (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Sat, 05 Nov 2011 00:04:32 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from recoil.dh.bytemark.co.uk ([89.16.177.154]:4348
	helo=dark.recoil.org)
	by ppsw-50.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.147]:25)
	with smtp (csa=unknown) id 1RMTkN-0007NT-rU (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Sat, 05 Nov 2011 00:04:32 +0000
Received: (qmail 32260 invoked by uid 634); 5 Nov 2011 00:04:31 -0000
X-Spam-Level: *
X-Spam-Status: No, hits=-1.4 required=5.0
	tests=ALL_TRUSTED
X-Spam-Check-By: dark.recoil.org
Received: from cpc2-belf1-0-0-cust23.2-1.cable.virginmedia.com (HELO
	[10.0.1.14]) (82.29.224.24)
	(smtp-auth username remote@recoil.org, mechanism cram-md5)
	by dark.recoil.org (qpsmtpd/0.83) with ESMTPA;
	Sat, 05 Nov 2011 00:04:31 +0000
Subject: Re: sockets exn- one day i'll learn to put things down
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset=us-ascii
From: Anil Madhavapeddy <anil@recoil.org>
In-Reply-To: <D37EB03E-5A70-4753-BC89-33735D1D89F4@nottingham.ac.uk>
Date: Sat, 5 Nov 2011 00:04:28 +0000
Content-Transfer-Encoding: 7bit
Message-Id: <A6522886-F693-4218-AD63-38137289AAF1@recoil.org>
References: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
	<7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
	<BC9CE1FC-4F05-4D09-9F49-5090313249DA@nottingham.ac.uk>
	<20111104094003.GB10177@dark.recoil.org>
	<D37EB03E-5A70-4753-BC89-33735D1D89F4@nottingham.ac.uk>
To: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
X-Mailer: Apple Mail (2.1251.1)
X-Virus-Checked: Checked by ClamAV on dark.recoil.org
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Sat, 05 Nov 2011 00:04:32 -0000
X-Keywords:                  
X-UID: 129
Status: O
Content-Length: 328
Lines: 20


On 4 Nov 2011, at 21:16, Richard Mortier wrote:

> let close t =
>  R.close t.fd;
>  Lwt.wakeup t.abort_u ();
>  return ()
> 

The try/catch would need to go locally here; can you try

let close t =
  R.close t.fd;
  (try Lwt.wakeup t.abort_u () with _ -> ());
  return ()

This should make multiple close() calls safe.

Anil


From Richard.Mortier@nottingham.ac.uk Sat Nov 05 08:49:26 2011
Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RMbwM-0006Gt-58 (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Sat, 05 Nov 2011 08:49:26 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from ixe-mta-19-tx.emailfiltering.com ([194.116.198.150]:43672
	helo=ixe-mta-19.emailfiltering.com)
	by ppsw-50.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.147]:25)
	with esmtp (csa=unknown) id 1RMbwG-0007W5-s4 (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Sat, 05 Nov 2011 08:49:26 +0000
Received: from smtp1.nottingham.ac.uk ([128.243.44.4])
	by ixe-mta-19.emailfiltering.com with emfmta (version 4.8.5.36) vanilla
	id 2026504340 for cl-mirage@lists.cam.ac.uk; 4310feed0aaee424;
	Sat, 05 Nov 2011 08:49:00 +0000
Received: from uiwexhub01.ad.nottingham.ac.uk ([128.243.15.133])
	by smtp1.nottingham.ac.uk with esmtp (Exim 4.60)
	(envelope-from <Richard.Mortier@nottingham.ac.uk>)
	id 1RMbvJ-0005E3-6I
	for cl-mirage@lists.cam.ac.uk; Sat, 05 Nov 2011 08:48:21 +0000
Received: from EXCHANGE1.ad.nottingham.ac.uk ([fe80::7962:f868:e6ee:6267]) by
	UIWEXHUB01.ad.nottingham.ac.uk ([2002:80f3:f85::80f3:f85]) with mapi;
	Sat, 5 Nov 2011 08:47:47 +0000
From: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
To: Anil Madhavapeddy <anil@recoil.org>
Date: Sat, 5 Nov 2011 08:46:38 +0000
Subject: Re: sockets exn- one day i'll learn to put things down
Thread-Topic: sockets exn- one day i'll learn to put things down
Thread-Index: Acybl5cr70FkBMx8Qoir6BK6ZMKizA==
Message-ID: <05566CBD-3E60-4BD0-80BF-78F43E91388C@nottingham.ac.uk>
References: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
	<7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
	<BC9CE1FC-4F05-4D09-9F49-5090313249DA@nottingham.ac.uk>
	<20111104094003.GB10177@dark.recoil.org>
	<D37EB03E-5A70-4753-BC89-33735D1D89F4@nottingham.ac.uk>
	<A6522886-F693-4218-AD63-38137289AAF1@recoil.org>
In-Reply-To: <A6522886-F693-4218-AD63-38137289AAF1@recoil.org>
Accept-Language: en-US, en-GB
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US, en-GB
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Sat, 05 Nov 2011 08:49:26 -0000
X-Keywords:                  
X-UID: 130
Status: O
Content-Length: 1697
Lines: 44


On 5 Nov 2011, at 00:04, Anil Madhavapeddy wrote:

> The try/catch would need to go locally here; can you try
>=20
> let close t =3D
>  R.close t.fd;
>  (try Lwt.wakeup t.abort_u () with _ -> ());
>  return ()
>=20
> This should make multiple close() calls safe.

done- pull req sent, both for this fix and modifications to enable turning =
on/off lwt-debug.

seems to fix the crashes i've been observing, which is nice :)  though i'm =
still a little disconcerted as to what was actually causing it- the debug o=
utput i had in place suggested it wasn't getting called twice due to the ex=
n handler.  (but that might be my debug output coming out in an unexpected =
order.)

anyway- back to content production i guess ;)
--=20
Cheers,

R.

i apologise for the rather long and pointless legalese that usually follows=
 - i have no control over this. it embarrasses me as much as it irritates y=
ou...

=
This message and any attachment are intended solely for the addressee a=
nd may contain confidential information. If you have received this mess=
age in error, please send it back to me, and immediately delete it.   P=
lease do not use, copy or disclose the information contained in this me=
ssage or in any attachment.  Any views or opinions expressed by the aut=
hor of this email do not necessarily reflect the views of the Universit=
y of Nottingham.=0D=0A=0D=0AThis message has been checked for viruses b=
ut the contents of an attachment=0D=0Amay still contain software viruse=
s which could damage your computer system:=0D=0Ayou are advised to perf=
orm your own checks. Email communications with the=0D=0AUniversity of N=
ottingham may be monitored as permitted by UK legislation.=


From avsm@dark.recoil.org Tue Nov 08 10:35:23 2011
Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RNj1X-0002IB-O6 (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <avsm@dark.recoil.org>); Tue, 08 Nov 2011 10:35:23 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from recoil.dh.bytemark.co.uk ([89.16.177.154]:9880
	helo=dark.recoil.org)
	by ppsw-41.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.146]:25)
	with smtp (csa=unknown) id 1RNj1X-00073F-Qo (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <avsm@dark.recoil.org>); Tue, 08 Nov 2011 10:35:23 +0000
Received: (qmail 7781 invoked by uid 10000); 8 Nov 2011 10:35:23 -0000
Date: Tue, 8 Nov 2011 10:35:23 +0000
From: Anil Madhavapeddy <anil@recoil.org>
To: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
Subject: Re: sockets exn- one day i'll learn to put things down
Message-ID: <20111108103522.GA21522@dark.recoil.org>
References: <6A87E742-82F2-479A-A587-309D2143CF4E@nottingham.ac.uk>
	<7691AA1C-3B04-4FDF-8983-91538CAC4313@recoil.org>
	<BC9CE1FC-4F05-4D09-9F49-5090313249DA@nottingham.ac.uk>
	<20111104094003.GB10177@dark.recoil.org>
	<D37EB03E-5A70-4753-BC89-33735D1D89F4@nottingham.ac.uk>
	<A6522886-F693-4218-AD63-38137289AAF1@recoil.org>
	<05566CBD-3E60-4BD0-80BF-78F43E91388C@nottingham.ac.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <05566CBD-3E60-4BD0-80BF-78F43E91388C@nottingham.ac.uk>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: Mirage List <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Tue, 08 Nov 2011 10:35:23 -0000
X-Keywords:                  
X-UID: 131
Status: O
Content-Length: 1120
Lines: 32

On Sat, Nov 05, 2011 at 08:46:38AM +0000, Richard Mortier wrote:
> 
> On 5 Nov 2011, at 00:04, Anil Madhavapeddy wrote:
> 
> > The try/catch would need to go locally here; can you try
> > 
> > let close t =
> >  R.close t.fd;
> >  (try Lwt.wakeup t.abort_u () with _ -> ());
> >  return ()
> > 
> > This should make multiple close() calls safe.
> 
> done- pull req sent, both for this fix and modifications to enable
> turning on/off lwt-debug.

Thanks, merged! Very handy to have this...

> seems to fix the crashes i've been observing, which is nice :)  though
> i'm still a little disconcerted as to what was actually causing it- the
> debug output i had in place suggested it wasn't getting called twice due
> to the exn handler.  (but that might be my debug output coming out in an
> unexpected order.)

Its somewhat complicated by libev; at some point, I'm going to take a look
at removing libev and (maybe) integrating the system that node.js uses
(libuv).  For now though, it works well enough to not make it worth the
trouble.  I've updated the live website and it seems to have to stopped
crashing too!

Anil


From h.rotsos@gmail.com Fri Nov 11 09:35:24 2011
Received: from ppsw-51.csi.cam.ac.uk ([131.111.8.151])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1ROnW8-0004E0-4k (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <h.rotsos@gmail.com>); Fri, 11 Nov 2011 09:35:24 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -2.6 from SpamAssassin-3.3.2-1195874 
	* -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,
	low *      trust
	*      [209.85.212.51 listed in list.dnswl.dnsbl.ja.net]
	* 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
	provider *       (h.rotsos[at]gmail.com)
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
	*  0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
	*      valid
	* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from mail-vw0-f51.google.com ([209.85.212.51]:62711)
	by ppsw-51.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.148]:25)
	with esmtp (csa=unknown) id 1ROnW6-0000BE-XW (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <h.rotsos@gmail.com>); Fri, 11 Nov 2011 09:35:23 +0000
Received: by vwl15 with SMTP id 15so3654025vwl.38
	for <cl-mirage@lists.cam.ac.uk>; Fri, 11 Nov 2011 01:35:21 -0800 (PST)
MIME-Version: 1.0
Received: by 10.229.42.8 with SMTP id q8mr1709693qce.51.1321004121670; Fri, 11
	Nov 2011 01:35:21 -0800 (PST)
Sender: h.rotsos@gmail.com
Received: by 10.229.242.70 with HTTP; Fri, 11 Nov 2011 01:35:21 -0800 (PST)
Date: Fri, 11 Nov 2011 09:35:21 +0000
X-Google-Sender-Auth: mxuMurw1YxX3cDD2-ppw31DPDeQ
Message-ID: <CALerif5By6zrijLkXz6_YiFoDSj1OYCgZLfLfxwGgY73dzK-Bg@mail.gmail.com>
Subject: wildcard match like comparison in ocaml
From: Haris Rotsos <cr409@cl.cam.ac.uk>
To: "cl-mirage@lists.cam.ac.uk Mailing List" <cl-mirage@lists.cam.ac.uk>
Content-Type: text/plain; charset=UTF-8
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Fri, 11 Nov 2011 09:35:24 -0000
X-Keywords:                  
X-UID: 132
Status: O
Content-Length: 605
Lines: 25

Hi all,

I have a quick question regarding pattern matching in ocaml. I am
interested for a module that can perform multiple wildcarded pattern
matches in parallel in an efficient way. In routers a mechanism to
achieve such functionality is to use a trie structure or a tcam. Are
you aware of any readily available modules in ocaml that implements
such fucntionality.

thanks in advance for tips/pointers,


-- 
Charalampos Rotsos
PhD student
The University of Cambridge
Computer Laboratory
William Gates Building
JJ Thomson Avenue
Cambridge
CB3 0FD

Phone: +44-(0) 1223 767032
Email: cr409@cl.cam.ac.uk


From anil@recoil.org Fri Nov 11 10:16:54 2011
Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1ROoAI-0007A6-F2 (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Fri, 11 Nov 2011 10:16:54 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from recoil.dh.bytemark.co.uk ([89.16.177.154]:46472
	helo=dark.recoil.org)
	by ppsw-41.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.146]:25)
	with smtp (csa=unknown) id 1ROoAG-00004w-SU (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Fri, 11 Nov 2011 10:16:54 +0000
Received: (qmail 640 invoked by uid 634); 11 Nov 2011 10:16:52 -0000
X-Spam-Level: *
X-Spam-Status: No, hits=-1.4 required=5.0
	tests=ALL_TRUSTED
X-Spam-Check-By: dark.recoil.org
Received: from freak-0.srg.cl.cam.ac.uk (HELO [192.168.2.8]) (128.232.32.220)
	(smtp-auth username remote@recoil.org, mechanism cram-md5)
	by dark.recoil.org (qpsmtpd/0.83) with ESMTPA;
	Fri, 11 Nov 2011 10:16:47 +0000
Subject: Re: wildcard match like comparison in ocaml
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset=us-ascii
From: Anil Madhavapeddy <anil@recoil.org>
In-Reply-To: <CALerif5By6zrijLkXz6_YiFoDSj1OYCgZLfLfxwGgY73dzK-Bg@mail.gmail.com>
Date: Fri, 11 Nov 2011 10:16:44 +0000
Content-Transfer-Encoding: quoted-printable
Message-Id: <BFA41106-4370-41CE-AEA3-78D82BEE7E78@recoil.org>
References: <CALerif5By6zrijLkXz6_YiFoDSj1OYCgZLfLfxwGgY73dzK-Bg@mail.gmail.com>
To: Haris Rotsos <cr409@cl.cam.ac.uk>
X-Mailer: Apple Mail (2.1251.1)
X-Virus-Checked: Checked by ClamAV on dark.recoil.org
Cc: "cl-mirage@lists.cam.ac.uk Mailing List" <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Fri, 11 Nov 2011 10:16:54 -0000
X-Keywords:                  
X-UID: 133
Status: O
Content-Length: 1108
Lines: 41

There's quite a few out there. You could grab the one locally in Mirage, =
which is currently specialised for DNS lookups (a 256-way one)
https://github.com/avsm/mirage/blob/master/lib/dns/dnstrie.ml

Alternatively, there's a general one here:
http://www.lri.fr/~filliatr/ftp/ocaml/ds/trie.ml.html

Both are pretty small so you should be able to customise/tweak them as =
needed...

-anil

On 11 Nov 2011, at 09:35, Haris Rotsos wrote:

> Hi all,
>=20
> I have a quick question regarding pattern matching in ocaml. I am
> interested for a module that can perform multiple wildcarded pattern
> matches in parallel in an efficient way. In routers a mechanism to
> achieve such functionality is to use a trie structure or a tcam. Are
> you aware of any readily available modules in ocaml that implements
> such fucntionality.
>=20
> thanks in advance for tips/pointers,
>=20
>=20
> --=20
> Charalampos Rotsos
> PhD student
> The University of Cambridge
> Computer Laboratory
> William Gates Building
> JJ Thomson Avenue
> Cambridge
> CB3 0FD
>=20
> Phone: +44-(0) 1223 767032
> Email: cr409@cl.cam.ac.uk
>=20



From h.rotsos@gmail.com Wed Nov 16 10:29:06 2011
Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RQcjq-00029e-2q (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <h.rotsos@gmail.com>); Wed, 16 Nov 2011 10:29:06 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -2.6 from SpamAssassin-3.3.2-1195874 
	* -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,
	low *      trust
	*      [209.85.212.51 listed in list.dnswl.dnsbl.ja.net]
	* 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
	provider *       (h.rotsos[at]gmail.com)
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
	*  0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
	*      valid
	* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from mail-vw0-f51.google.com ([209.85.212.51]:34062)
	by ppsw-41.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.146]:25)
	with esmtp (csa=unknown) id 1RQcjo-0006eL-QQ (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <h.rotsos@gmail.com>); Wed, 16 Nov 2011 10:29:06 +0000
Received: by vws8 with SMTP id 8so1104977vws.38
	for <cl-mirage@lists.cam.ac.uk>; Wed, 16 Nov 2011 02:29:03 -0800 (PST)
MIME-Version: 1.0
Received: by 10.224.27.11 with SMTP id g11mr8202281qac.51.1321439343442; Wed,
	16 Nov 2011 02:29:03 -0800 (PST)
Sender: h.rotsos@gmail.com
Received: by 10.229.242.70 with HTTP; Wed, 16 Nov 2011 02:29:03 -0800 (PST)
Date: Wed, 16 Nov 2011 10:29:03 +0000
X-Google-Sender-Auth: LOswLcMTWNIykQOmqv59GFQR7jw
Message-ID: <CALerif77TV490j7xzSpWFpQygV0GuZixo=ETa4OFtJAWuZ=SAg@mail.gmail.com>
Subject: micro second timestamps from a regression test progrsm
From: Haris Rotsos <cr409@cl.cam.ac.uk>
To: "cl-mirage@lists.cam.ac.uk Mailing List" <cl-mirage@lists.cam.ac.uk>
Content-Type: text/plain; charset=UTF-8
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 16 Nov 2011 10:29:06 -0000
X-Keywords:                  
X-UID: 134
Status: O
Content-Length: 417
Lines: 20

Hi all,

i was wondering how I can get microsecond timestamps from a test
progrm of the mirge library. I tried the Unix.gettimeofday, but the
module is not include at compile time. Is there some other module I
can use?

-- 
Charalampos Rotsos
PhD student
The University of Cambridge
Computer Laboratory
William Gates Building
JJ Thomson Avenue
Cambridge
CB3 0FD

Phone: +44-(0) 1223 767032
Email: cr409@cl.cam.ac.uk


From Richard.Mortier@nottingham.ac.uk Wed Nov 16 12:04:33 2011
Received: from ppsw-41.csi.cam.ac.uk ([131.111.8.141])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RQeED-0007Dz-PZ (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Wed, 16 Nov 2011 12:04:33 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from ixe-mta-19-tx.emailfiltering.com ([194.116.198.150]:46781
	helo=ixe-mta-19.emailfiltering.com)
	by ppsw-41.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.146]:25)
	with esmtp (csa=unknown) id 1RQeE8-0006Yv-Qz (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <Richard.Mortier@nottingham.ac.uk>);
	Wed, 16 Nov 2011 12:04:33 +0000
Received: from smtp2.nottingham.ac.uk ([128.243.44.5])
	by ixe-mta-19.emailfiltering.com with emfmta (version 4.8.5.36) vanilla
	id 2038377728 for cr409@cl.cam.ac.uk; ffbf049f29a664f1;
	Wed, 16 Nov 2011 12:03:41 +0000
Received: from uiwexhub02.ad.nottingham.ac.uk ([128.243.15.132])
	by smtp2.nottingham.ac.uk with esmtp (Exim 4.60)
	(envelope-from <Richard.Mortier@nottingham.ac.uk>)
	id 1RQeCh-0008Ak-57; Wed, 16 Nov 2011 12:02:59 +0000
Received: from EXCHANGE1.ad.nottingham.ac.uk ([fe80::7962:f868:e6ee:6267]) by
	UIWEXHUB02.ad.nottingham.ac.uk ([2002:80f3:f84::80f3:f84]) with mapi;
	Wed, 16 Nov 2011 12:04:11 +0000
From: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
To: Haris Rotsos <cr409@cl.cam.ac.uk>
Date: Wed, 16 Nov 2011 12:02:56 +0000
Subject: Re: micro second timestamps from a regression test progrsm
Thread-Topic: micro second timestamps from a regression test progrsm
Thread-Index: AcykV9UXYXiwM1P/R9G7lLMN+oo1GQ==
Message-ID: <DA6DD110-C3A8-4224-9E8D-40EB4CDF79CB@nottingham.ac.uk>
References: <CALerif77TV490j7xzSpWFpQygV0GuZixo=ETa4OFtJAWuZ=SAg@mail.gmail.com>
In-Reply-To: <CALerif77TV490j7xzSpWFpQygV0GuZixo=ETa4OFtJAWuZ=SAg@mail.gmail.com>
Accept-Language: en-US, en-GB
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
acceptlanguage: en-US, en-GB
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: "cl-mirage@lists.cam.ac.uk Mailing List" <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 16 Nov 2011 12:04:33 -0000
X-Keywords:                  
X-UID: 135
Status: O
Content-Length: 1444
Lines: 46

ought to be pretty easy to add as a c extension to the unix-* backends (i t=
hink- happy to be contradicted... :)

On 16 Nov 2011, at 10:29, Haris Rotsos wrote:

> Hi all,
>=20
> i was wondering how I can get microsecond timestamps from a test
> progrm of the mirge library. I tried the Unix.gettimeofday, but the
> module is not include at compile time. Is there some other module I
> can use?
>=20
> --=20
> Charalampos Rotsos
> PhD student
> The University of Cambridge
> Computer Laboratory
> William Gates Building
> JJ Thomson Avenue
> Cambridge
> CB3 0FD
>=20
> Phone: +44-(0) 1223 767032
> Email: cr409@cl.cam.ac.uk
>=20

--=20
Cheers,

R.



=
This message and any attachment are intended solely for the addressee a=
nd may contain confidential information. If you have received this mess=
age in error, please send it back to me, and immediately delete it.   P=
lease do not use, copy or disclose the information contained in this me=
ssage or in any attachment.  Any views or opinions expressed by the aut=
hor of this email do not necessarily reflect the views of the Universit=
y of Nottingham.=0D=0A=0D=0AThis message has been checked for viruses b=
ut the contents of an attachment=0D=0Amay still contain software viruse=
s which could damage your computer system:=0D=0Ayou are advised to perf=
orm your own checks. Email communications with the=0D=0AUniversity of N=
ottingham may be monitored as permitted by UK legislation.=


From h.rotsos@gmail.com Wed Nov 16 12:09:10 2011
Received: from ppsw-52.csi.cam.ac.uk ([131.111.8.152])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RQeIg-0007Sm-6U (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <h.rotsos@gmail.com>); Wed, 16 Nov 2011 12:09:10 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -2.6 from SpamAssassin-3.3.2-1195874 
	* -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,
	low *      trust
	*      [209.85.161.179 listed in list.dnswl.dnsbl.ja.net]
	* 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
	provider *       (h.rotsos[at]gmail.com)
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
	*  0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
	*      valid
	* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from mail-gx0-f179.google.com ([209.85.161.179]:63162)
	by ppsw-52.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.149]:25)
	with esmtp (csa=unknown) id 1RQeIe-0000Ed-EW (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <h.rotsos@gmail.com>); Wed, 16 Nov 2011 12:09:10 +0000
Received: by ggnq2 with SMTP id q2so5909159ggn.38
	for <cl-mirage@lists.cam.ac.uk>; Wed, 16 Nov 2011 04:09:07 -0800 (PST)
MIME-Version: 1.0
Received: by 10.229.67.213 with SMTP id s21mr4746990qci.89.1321445347650; Wed,
	16 Nov 2011 04:09:07 -0800 (PST)
Sender: h.rotsos@gmail.com
Received: by 10.229.242.70 with HTTP; Wed, 16 Nov 2011 04:09:07 -0800 (PST)
In-Reply-To: <DA6DD110-C3A8-4224-9E8D-40EB4CDF79CB@nottingham.ac.uk>
References: <CALerif77TV490j7xzSpWFpQygV0GuZixo=ETa4OFtJAWuZ=SAg@mail.gmail.com>
	<DA6DD110-C3A8-4224-9E8D-40EB4CDF79CB@nottingham.ac.uk>
Date: Wed, 16 Nov 2011 12:09:07 +0000
X-Google-Sender-Auth: rMacmGfFv56-jSry1kiVq9l4FMc
Message-ID: <CALerif42gi2H6YjYDVd0s7qqRZEbm6ZO-nF50kiAywHzJVs7MA@mail.gmail.com>
Subject: Re: micro second timestamps from a regression test progrsm
From: Haris Rotsos <Charalampos.Rotsos@cl.cam.ac.uk>
To: Richard Mortier <Richard.Mortier@nottingham.ac.uk>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: "cl-mirage@lists.cam.ac.uk Mailing List" <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 16 Nov 2011 12:09:10 -0000
X-Keywords:                  
X-UID: 136
Status: O
Content-Length: 1843
Lines: 68

I found something at OS.Clock.time() (unit -> float). This I think
binds back to the libc gettimeofday.

On 16 November 2011 12:02, Richard Mortier
<Richard.Mortier@nottingham.ac.uk> wrote:
> ought to be pretty easy to add as a c extension to the unix-* backends (i=
 think- happy to be contradicted... :)
>
> On 16 Nov 2011, at 10:29, Haris Rotsos wrote:
>
>> Hi all,
>>
>> i was wondering how I can get microsecond timestamps from a test
>> progrm of the mirge library. I tried the Unix.gettimeofday, but the
>> module is not include at compile time. Is there some other module I
>> can use?
>>
>> --
>> Charalampos Rotsos
>> PhD student
>> The University of Cambridge
>> Computer Laboratory
>> William Gates Building
>> JJ Thomson Avenue
>> Cambridge
>> CB3 0FD
>>
>> Phone: +44-(0) 1223 767032
>> Email: cr409@cl.cam.ac.uk
>>
>
> --
> Cheers,
>
> R.
>
>
>
> This message and any attachment are intended solely for the addressee and=
 may contain confidential information. If you have received this message in=
 error, please send it back to me, and immediately delete it. =C2=A0 Please=
 do not use, copy or disclose the information contained in this message or =
in any attachment. =C2=A0Any views or opinions expressed by the author of t=
his email do not necessarily reflect the views of the University of Notting=
ham.
>
> This message has been checked for viruses but the contents of an attachme=
nt
> may still contain software viruses which could damage your computer syste=
m:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.



--=20
Charalampos Rotsos
PhD student
The University of Cambridge
Computer Laboratory
William Gates Building
JJ Thomson Avenue
Cambridge
CB3 0FD

Phone: +44-(0) 1223 767032
Email: cr409@cl.cam.ac.uk


From robert.watson@cl.cam.ac.uk Wed Nov 16 12:12:20 2011
Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RQeLk-0007jd-79 (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk (return-path <robert.watson@cl.cam.ac.uk>);
	Wed, 16 Nov 2011 12:12:20 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from cyrus.watson.org ([65.122.17.42]:11008)
	by ppsw-50.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.147]:25)
	with esmtp (csa=unknown) id 1RQeLg-0000BH-s3 (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk (return-path <robert.watson@cl.cam.ac.uk>);
	Wed, 16 Nov 2011 12:12:20 +0000
Received: from c0166.aw.cl.cam.ac.uk (c0166.aw.cl.cam.ac.uk [128.232.100.166])
	by cyrus.watson.org (Postfix) with ESMTPSA id B079B46B09;
	Wed, 16 Nov 2011 07:12:14 -0500 (EST)
Subject: Re: micro second timestamps from a regression test progrsm
Mime-Version: 1.0 (Apple Message framework v1084)
Content-Type: text/plain; charset=us-ascii
From: "Robert N. M. Watson" <robert.watson@cl.cam.ac.uk>
In-Reply-To: <CALerif42gi2H6YjYDVd0s7qqRZEbm6ZO-nF50kiAywHzJVs7MA@mail.gmail.com>
Date: Wed, 16 Nov 2011 12:12:13 +0000
Content-Transfer-Encoding: quoted-printable
Message-Id: <73EEBDDB-33D7-4180-BA74-EE55A2B6E94C@cl.cam.ac.uk>
References: <CALerif77TV490j7xzSpWFpQygV0GuZixo=ETa4OFtJAWuZ=SAg@mail.gmail.com>
	<DA6DD110-C3A8-4224-9E8D-40EB4CDF79CB@nottingham.ac.uk>
	<CALerif42gi2H6YjYDVd0s7qqRZEbm6ZO-nF50kiAywHzJVs7MA@mail.gmail.com>
To: Haris Rotsos <Charalampos.Rotsos@cl.cam.ac.uk>
X-Mailer: Apple Mail (2.1084)
Cc: Richard Mortier <Richard.Mortier@nottingham.ac.uk>,
	"cl-mirage@lists.cam.ac.uk Mailing List" <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 16 Nov 2011 12:12:20 -0000
X-Keywords:                  
X-UID: 137
Status: O
Content-Length: 748
Lines: 19


On 16 Nov 2011, at 12:09, Haris Rotsos wrote:

> I found something at OS.Clock.time() (unit -> float). This I think
> binds back to the libc gettimeofday.

On the UNIX side, a good general piece of advice for accurate =
time-keeping is to use clock_gettime() and name a high-accuracy clock. =
You can also use clock_getres() to ask questions about the resolution of =
the timestamps you get back. On FreeBSD, at least, you can request =
accurate vs. fast using different clock names. Finally, asking for the =
time of day is not quite the same as asking for elapsed time, so you =
might or might not be interested in asking for a monotonic time source =
instead of a time-of-day time source, depending on your goals and how =
NTP feels.

Robert



From anil@recoil.org Wed Nov 16 13:30:44 2011
Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150])
	by lists-2.csi.cam.ac.uk (lists.cam.ac.uk [131.111.8.15]:25)
	with esmtp id 1RQfZc-0003mm-Rr (Exim 4.70) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Wed, 16 Nov 2011 13:30:44 +0000
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: score -1.9 from SpamAssassin-3.3.2-1195874 
	* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
	*      [score: 0.0000]
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from recoil.dh.bytemark.co.uk ([89.16.177.154]:32952
	helo=dark.recoil.org)
	by ppsw-50.csi.cam.ac.uk (mx.cam.ac.uk [131.111.8.147]:25)
	with smtp (csa=unknown) id 1RQfZc-0007BI-r5 (Exim 4.72) for
	cl-mirage@lists.cam.ac.uk
	(return-path <anil@recoil.org>); Wed, 16 Nov 2011 13:30:44 +0000
Received: (qmail 11962 invoked by uid 634); 16 Nov 2011 13:30:44 -0000
X-Spam-Level: *
X-Spam-Status: No, hits=-1.4 required=5.0
	tests=ALL_TRUSTED
X-Spam-Check-By: dark.recoil.org
Received: from host81-149-102-120.in-addr.btopenworld.com (HELO
	[192.168.0.18]) (81.149.102.120)
	(smtp-auth username remote@recoil.org, mechanism cram-md5)
	by dark.recoil.org (qpsmtpd/0.83) with ESMTPA;
	Wed, 16 Nov 2011 13:30:44 +0000
Subject: Re: micro second timestamps from a regression test progrsm
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset=us-ascii
From: Anil Madhavapeddy <anil@recoil.org>
In-Reply-To: <CALerif42gi2H6YjYDVd0s7qqRZEbm6ZO-nF50kiAywHzJVs7MA@mail.gmail.com>
Date: Wed, 16 Nov 2011 13:30:42 +0000
Content-Transfer-Encoding: quoted-printable
Message-Id: <A8C15A6C-E003-4993-A3CE-AB8950EFAA0B@recoil.org>
References: <CALerif77TV490j7xzSpWFpQygV0GuZixo=ETa4OFtJAWuZ=SAg@mail.gmail.com>
	<DA6DD110-C3A8-4224-9E8D-40EB4CDF79CB@nottingham.ac.uk>
	<CALerif42gi2H6YjYDVd0s7qqRZEbm6ZO-nF50kiAywHzJVs7MA@mail.gmail.com>
To: Haris Rotsos <Charalampos.Rotsos@cl.cam.ac.uk>
X-Mailer: Apple Mail (2.1251.1)
X-Virus-Checked: Checked by ClamAV on dark.recoil.org
Cc: Richard Mortier <Richard.Mortier@nottingham.ac.uk>,
	"cl-mirage@lists.cam.ac.uk Mailing List" <cl-mirage@lists.cam.ac.uk>
X-BeenThere: cl-mirage@lists.cam.ac.uk
X-Mailman-Version: 2.1.8
Precedence: list
List-Id: MirageOS development <cl-mirage.lists.cam.ac.uk>
List-Unsubscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=unsubscribe>
List-Archive: <https://lists.cam.ac.uk/pipermail/cl-mirage>
List-Post: <mailto:cl-mirage@lists.cam.ac.uk>
List-Help: <mailto:cl-mirage-request@lists.cam.ac.uk?subject=help>
List-Subscribe: <https://lists.cam.ac.uk/mailman/listinfo/cl-mirage>,
	<mailto:cl-mirage-request@lists.cam.ac.uk?subject=subscribe>
X-List-Received-Date: Wed, 16 Nov 2011 13:30:44 -0000
X-Keywords:                  
X-UID: 138
Status: O
Content-Length: 2288
Lines: 81

That's the correct call. It uses the Xen monotonic timer, or the UNIX =
equivalent. This is current gettimeofday(), but could easily be upgraded =
to a higher resolution timer on UNIX (as Robert suggests) if necessary =
(which it isn't at the moment for your tests).

Anil

On 16 Nov 2011, at 12:09, Haris Rotsos wrote:

> I found something at OS.Clock.time() (unit -> float). This I think
> binds back to the libc gettimeofday.
>=20
> On 16 November 2011 12:02, Richard Mortier
> <Richard.Mortier@nottingham.ac.uk> wrote:
>> ought to be pretty easy to add as a c extension to the unix-* =
backends (i think- happy to be contradicted... :)
>>=20
>> On 16 Nov 2011, at 10:29, Haris Rotsos wrote:
>>=20
>>> Hi all,
>>>=20
>>> i was wondering how I can get microsecond timestamps from a test
>>> progrm of the mirge library. I tried the Unix.gettimeofday, but the
>>> module is not include at compile time. Is there some other module I
>>> can use?
>>>=20
>>> --
>>> Charalampos Rotsos
>>> PhD student
>>> The University of Cambridge
>>> Computer Laboratory
>>> William Gates Building
>>> JJ Thomson Avenue
>>> Cambridge
>>> CB3 0FD
>>>=20
>>> Phone: +44-(0) 1223 767032
>>> Email: cr409@cl.cam.ac.uk
>>>=20
>>=20
>> --
>> Cheers,
>>=20
>> R.
>>=20
>>=20
>>=20
>> This message and any attachment are intended solely for the addressee =
and may contain confidential information. If you have received this =
message in error, please send it back to me, and immediately delete it.  =
 Please do not use, copy or disclose the information contained in this =
message or in any attachment.  Any views or opinions expressed by the =
author of this email do not necessarily reflect the views of the =
University of Nottingham.
>>=20
>> This message has been checked for viruses but the contents of an =
attachment
>> may still contain software viruses which could damage your computer =
system:
>> you are advised to perform your own checks. Email communications with =
the
>> University of Nottingham may be monitored as permitted by UK =
legislation.
>=20
>=20
>=20
> --=20
> Charalampos Rotsos
> PhD student
> The University of Cambridge
> Computer Laboratory
> William Gates Building
> JJ Thomson Avenue
> Cambridge
> CB3 0FD
>=20
> Phone: +44-(0) 1223 767032
> Email: cr409@cl.cam.ac.uk
>=20



