Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006078OCamlOCaml runtime systempublic2013-07-16 12:462015-05-02 17:34
Reporterdim 
Assigned Todim 
PrioritylowSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.00.1 
Target Version4.02.2+devFixed in Version4.02.2+dev 
Summary0006078: Release the runtime system when calling caml_dlopen
Descriptiondlopen is a blocking operation so it should release the global lock. The attached patch does this.
Tagspatch
Attached Filespatch file icon 0001-release-the-runtime-system-when-calling-caml_dlopen.patch [^] (2,786 bytes) 2015-02-27 10:38 [Show Content]

- Relationships

-  Notes
(0013349)
doligez (administrator)
2015-02-26 19:12

The patch looks good. Is there any reason not to apply it now?
(0013352)
dim (developer)
2015-02-27 10:38

I think it can be applied. I updated the patch to use caml_strdup.
(0013370)
dim (developer)
2015-03-03 14:40

Unless someone object I'll merge it.
(0013385)
dim (developer)
2015-03-05 13:48

Committed in trunk (15878) and 4.02 (15879).
(0013392)
chambart (developer)
2015-03-05 20:23

Are you certain that dlopen is thread safe ? Couldn't there be strange stuff happening if multiple libraries are loaded at the same time ?
(0013401)
dim (developer)
2015-03-06 10:23

I'm not sure it is, but even if it is not it is not a reason to block the runtime. We shouldn't use the same mutex for every library call that is not thread-safe.
(0013402)
whitequark (developer)
2015-03-06 10:25

I've looked into it a bit and it appears that on major platforms (Windows, Linux, OS X) the dynamic linker serializes the calls. POSIX doesn't specify this though, and NetBSD doesn't bother. (Does OCaml run on NetBSD?)
(0013546)
johnwhitington (reporter)
2015-03-25 16:29

This patch causes a warning on OS X under the latest XCode:

dynlink.c:122:3: warning: implicit declaration of function 'caml_enter_blocking_section' is invalid in C99 [-Wimplicit-function-declaration]
  caml_enter_blocking_section();
  ^
dynlink.c:124:3: warning: implicit declaration of function 'caml_leave_blocking_section' is invalid in C99 [-Wimplicit-function-declaration]
  caml_leave_blocking_section();
  ^
(0013547)
dim (developer)
2015-03-25 16:39

Ah indeed, I forgot to include signals.h. I'll fix that, thanks!
(0013548)
dim (developer)
2015-03-25 16:50

Committed in trunk (15963) and 4.02 (15962).

- Issue History
Date Modified Username Field Change
2013-07-16 12:46 dim New Issue
2013-07-16 12:46 dim Status new => assigned
2013-07-16 12:46 dim Assigned To => dim
2013-07-16 12:46 dim File Added: 0001-release-the-runtime-system-when-calling-caml_dlopen.patch
2013-07-16 16:24 frisch Target Version 4.01.0+dev => 4.01.1+dev
2013-07-17 13:00 dim File Deleted: 0001-release-the-runtime-system-when-calling-caml_dlopen.patch
2013-07-17 13:00 dim File Added: 0001-release-the-runtime-system-when-calling-caml_dlopen.patch
2014-01-17 16:06 doligez Tag Attached: patch
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-08-18 20:33 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-24 16:49 doligez Target Version undecided => 4.02.2+dev
2015-02-26 19:12 doligez Note Added: 0013349
2015-02-27 10:37 dim File Deleted: 0001-release-the-runtime-system-when-calling-caml_dlopen.patch
2015-02-27 10:38 dim File Added: 0001-release-the-runtime-system-when-calling-caml_dlopen.patch
2015-02-27 10:38 dim Note Added: 0013352
2015-03-03 14:40 dim Note Added: 0013370
2015-03-05 13:48 dim Note Added: 0013385
2015-03-05 13:48 dim Status assigned => resolved
2015-03-05 13:48 dim Fixed in Version => 4.02.2+dev
2015-03-05 13:48 dim Resolution open => fixed
2015-03-05 20:23 chambart Note Added: 0013392
2015-03-06 10:23 dim Note Added: 0013401
2015-03-06 10:25 whitequark Note Added: 0013402
2015-03-25 16:29 johnwhitington Note Added: 0013546
2015-03-25 16:39 dim Note Added: 0013547
2015-03-25 16:50 dim Note Added: 0013548


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker