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
signals and ocamlopt #3166
Comments
Comment author: administrator
Non, car le signal handler modifie caml_young_limit de telle manière Enfin, ça c'est la théorie. En pratique on a deux problèmes. Le Le second problème est, comme tu l'as remarqué:
Il y a un commentaire dans asmrun/signals.c qui explique cela: /* This routine is the common entry point for garbage collection Je ne sais pas si ce commentaire est toujours d'actualité. En Amitiés,
|
Comment author: administrator TODO: check whether it is still true that allocations performed in C must not |
Comment author: @mshinwell The only part outstanding from all those years ago is the question about the comment. I had a quick look at that and as far as I can see the comment is still accurate. The function caml_input_val_core initialises some global state (in [intern_init]) before calling [intern_alloc] which allocates on the OCaml heap. If a context switch were to occur at that point, the global variables initialised by [intern_init] might become clobbered by a concurrent demarshalling. |
Original bug ID: 3166
Reporter: administrator
Status: closed (set by @mshinwell on 2016-12-08T13:17:16Z)
Resolution: not a bug
Priority: low
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Bug description
D'apres le manuel d'ocamlopt:
Signals are detected only when the program performs an allocation in
the heap. That is, if a signal is delivered while in a piece of code
that does not allocate, its handler will not be called until the next
heap allocation.
Ca me parait completement faux: on attend en general le prochain appel
de caml_garbage_collection, qui ne se produit que lorsque le tas jeune
est plein. Ca peut demander un certain nombre d'allocations
successives.
De plus, tous les appels au GC ne passent pas par
caml_garbage_collection. En particulier, Alloc_small/caml_alloc_small
declenche le GC sans passer par la
, et est utilise' par toutes les fonctions C, y compris l'allocation des arrays. D'ou
la situation bizarre dans laquelle je me suis trouve' avec unpetit interprete compile' avec ocamlopt: il allouait a` tours de bras,
mais uniquement via Array.create et Obj.new_block. Par consequent,
caml_garbage_collection n'etait jamais appele', et les signaux
joyeusement ignores.
Il faudrait au moins corriger le manuel, et ca serait bien d'avoir un
moyen de traiter le cas ci-dessus. Je m'en suis sorti en allouant des
listes a` un element partout ou ca risque de boucler, mais c'est un peu
acrobatique.
Jacques
The text was updated successfully, but these errors were encountered: