Will Noble
2013-04-29 14:10:14 UTC
Hi all,
I'm having a problem with reinitializers. The macro DEFINE-REINITIALIZER
defines a record variable, which might or might not be reachable from a
resumer function. When it is not, the reinitialization routine doesn't make
it into the saved heap image.
(else (exec "date"))))
; no values returned
Resuming good.image and calling DATE works as expected, but running the VM
with bad.image hangs it because the reinitializer from the posix-process
module that installs signal handlers doesn't run, causing the system to
ignore SIGCHLD signals.
Using ADD-INITIALIZTION-THUNK! instead of a reinitializer doesn't work
because when the thunk runs posix.so would not yet have been loaded back in.
It seems to me that we should be able to expect reinitializers to run. I'm
not sure what the best solution here is. We could use a separate
second-stage initialization thunk list to implement reinitializers, instead
of the current method (relying on record resumers). Or maybe there is a
natural way of ensuring that reinitializers are always reachable. If we find
an acceptable solution I'd be happy to code it up.
Best,
Will
I'm having a problem with reinitializers. The macro DEFINE-REINITIALIZER
defines a record variable, which might or might not be reachable from a
resumer function. When it is not, the reinitialization routine doesn't make
it into the saved heap image.
,open posix
(define (date)
(cond ((fork) => wait-for-child-process)(define (date)
(else (exec "date"))))
; no values returned
,dump good.image
Writing good.image,build (lambda (args) (date) 0) bad.image
Writing bad.imageResuming good.image and calling DATE works as expected, but running the VM
with bad.image hangs it because the reinitializer from the posix-process
module that installs signal handlers doesn't run, causing the system to
ignore SIGCHLD signals.
Using ADD-INITIALIZTION-THUNK! instead of a reinitializer doesn't work
because when the thunk runs posix.so would not yet have been loaded back in.
It seems to me that we should be able to expect reinitializers to run. I'm
not sure what the best solution here is. We could use a separate
second-stage initialization thunk list to implement reinitializers, instead
of the current method (relying on record resumers). Or maybe there is a
natural way of ensuring that reinitializers are always reachable. If we find
an acceptable solution I'd be happy to code it up.
Best,
Will