Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004978OCamlOCaml generalpublic2010-02-15 22:452014-07-31 13:48
Reportergerd 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version3.11.1 
Target Version4.02.1+devFixed in Version 
Summary0004978: exceptions lose identity after marshalling
DescriptionLooks like exceptions cannot be matched against after marshalling them:

# exception S of int;;
exception S of int
# let mk_s s = S s;;
val mk_s : int -> exn = <fun>
# let dest_s (S s ) = s;;
Warning P: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
*exception*
val dest_s : exn -> int = <fun>
# dest_s (mk_s 42);;
- : int = 42
# dest_s (Marshal.from_string (Marshal.to_string (mk_s 42) []) 0);;
Exception: Match_failure ("", 1, 11).
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0001961closed Re: [Caml-list] Troubles with marshaled/unmarshaled exception 
has duplicate 0006154resolvedgasche marshal.mli should document the problem of marshaling exceptions. 

-  Notes
(0005245)
gerd (reporter)
2010-02-17 00:11

I've found a workaround in my code. So far I see it is difficult to fix this problem in Marshal: exceptions do not have a tag of their own, and cannot even recognized by the marshaller.

Maybe just mention this problem in the documentation?
(0005946)
doligez (administrator)
2011-05-31 16:51

Definitely mention the problem in the docs.
(0009037)
Boris Yakobowski (reporter)
2013-04-04 23:15

This just bit us (Frama-C) on a real run of analysis, and understanding the problem and its root was quite a challenge. On top of a mention in the documentation, detecting and warning at compile-time that the type of the marshalled value can contain exceptions somewhere would be a great help.
(0009038)
meyer (developer)
2013-04-05 00:08

Commit 13486, fixes the documentation part.
(0009497)
frisch (developer)
2013-06-14 14:22

Detecting at compile-time seems impossible in general. A runtime check would require some special representation of exception tags, but it is a good idea anyway (e.g. to fix the generic comparison).
(0010525)
frisch (developer)
2013-10-23 17:39
edited on: 2013-10-23 19:39

Work on the raise_variants branch changes the representation of exception tags and makes it possible to detect them during marshaling (tag = Object_tag, size = 2, first field points to a string value).

(0011551)
craff (reporter)
2014-05-22 16:47
edited on: 2014-05-22 16:47

This is a real problem when using the parmap library. This should really work,
at least when this is the same binary (like marshalling closures).

I would increase a little the severity


- Issue History
Date Modified Username Field Change
2010-02-15 22:45 gerd New Issue
2010-02-17 00:11 gerd Note Added: 0005245
2011-05-31 16:51 doligez Note Added: 0005946
2011-05-31 16:51 doligez Status new => acknowledged
2012-07-11 13:29 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-10 05:46 meyer Assigned To => meyer
2012-09-10 05:46 meyer Status acknowledged => assigned
2012-09-17 17:45 doligez Target Version 4.00.1+dev => 4.00.2+dev
2013-04-04 23:15 Boris Yakobowski Note Added: 0009037
2013-04-05 00:08 meyer Note Added: 0009038
2013-06-14 14:22 frisch Note Added: 0009497
2013-06-14 14:22 frisch Target Version 4.00.2+dev => 4.02.0+dev
2013-07-12 18:15 doligez Target Version 4.02.0+dev => 4.01.1+dev
2013-09-03 17:10 gasche Relationship added has duplicate 0006154
2013-10-23 17:39 frisch Note Added: 0010525
2013-10-23 19:39 frisch Note Edited: 0010525 View Revisions
2014-01-21 13:59 doligez Assigned To meyer =>
2014-05-03 00:00 gasche Relationship added duplicate of 0001961
2014-05-22 16:47 craff Note Added: 0011551
2014-05-22 16:47 craff Note Edited: 0011551 View Revisions
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-31 13:47 doligez Status assigned => acknowledged
2014-07-31 13:47 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-07-31 13:48 doligez Severity minor => major


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker