Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparing to Thread.self() raises exception at runtime #5306

Closed
vicuna opened this Issue Jun 29, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Jun 29, 2011

Original bug ID: 5306
Reporter: sigonnea
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2012-09-25T18:07:21Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.0
Fixed in version: 3.12.1+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: mehdi @ygrek

Bug description

Since Ocaml 3.12.0, when comparing Thread.self() to something, the following exception is raised : Invalid_argument "equal: abstract value"

How to reproduce: execute

Thread.self () = Thread.self ();;

in the toplevel. This returns "- : bool = true" with ocaml <= 3.11.2 and raises the mentionned execption with ocaml 3.12.0

This is a problem since:

  • code compiles but the exception is raised at runtime
  • I haven't seen about this in the detailed changelog for Ocaml 3.12.0

Additional information

This is not a big deal, since I can use Thread.id to perform my comparison. I was mostly worried that this wasn't documented in the release changelog.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Dec 13, 2011

Comment author: @gasche

I could trace the change of behavior back to the following source change in release/3.12.0:
http://caml.inria.fr/cgi-bin/viewvc.cgi?view=revision&revision=10220
the systhreads/ function moved from "posix.c" to "st_stubs.c".

In posix.c there was:
http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/newsysthreads/otherlibs/systhreads/posix.c?view=markup&pathrev=10219

static struct custom_operations caml_threadstatus_ops = {
"_threadstatus",
caml_threadstatus_finalize,
caml_mutex_condition_compare,
custom_hash_default,
custom_serialize_default,
custom_deserialize_default
};

while in st_stubs.c we now have:
http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/newsysthreads/otherlibs/systhreads/st_stubs.c?view=markup&pathrev=10220

static struct custom_operations caml_threadstatus_ops = {
"_threadstatus",
caml_threadstatus_finalize,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
custom_deserialize_default
};

The custom comparison operation changed from
caml_{mutex_}condition_compare to custom_compare_default, which
fails on comparison with the observed error: "equal: abstract value".

I have no idea whether the change was deliberate or by mistake. We'll
have to wait for confirmation on this.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Dec 13, 2011

Comment author: @xavierleroy

Thanks for the detective work. Pre-3.12 behavior restored in 3.12 bugfix branch (commit 11302) and in trunk (commit 11303).

@vicuna vicuna closed this Sep 25, 2012

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.