chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Chicken crashes when updating eggs


From: Thomas Chust
Subject: Re: [Chicken-users] Chicken crashes when updating eggs
Date: Wed, 7 Jun 2006 20:25:21 +0200 (CEST)

Hello,

it's probably important to know under which operating system this problem 
occurs.

POSIX compliant systems allow the deletion of files while they are open 
without causing trouble for the process that opened them. Win32 systems 
don't regularly allow it -- and in the cases where they do, it has 
different effects.

Although the dlopen family of calls or something just named differently 
but working the same way is fairly standard (and usually the only 
reasonable way to load shared libraries explicitly), it is not specified 
how the shared library is actually loaded. Most operating systems with 
virtual memory support will not load the whole library into RAM but rather 
open the file containing the library and memory-map some region in the 
address space of the process dlopening the library onto accesses to the 
open descriptor.

Under Win32 this means that a DLL that has been loaded by a program cannot 
be deleted during the runtime of that program anymore. Under POSIX 
compliant systems the shared library can be deleted and replaced -- but 
the process that dlopened the library will continue to use its old 
version, because the deletion of the file only removes its directory 
entry, while the open descriptor for the library that is memory-mapped for 
the process continues to point to the file system nodes of the old 
library. Only when the descriptor is closed, the reference count of the 
file system nodes will drop to zero finally causing the old library's data 
to be deleted as well as its directory entry.

What will likely cause problems under both Win32 and POSIX systems, 
though, is to just open a shared library used by another process and write 
some garbage into it, because this will probably instantaneously be 
reflected in the virtual memory pages mapped to the libary in the other 
process' address space. Thus, if you just replace the *contents* of a 
shared library in use with a newer version, the processes using it will 
likely now see the new version -- but there is no way that I know of to 
tell them to also reread the library's symbol table and to reresolve all 
the symbols before using them again. So unless every single symbol is 
still at the same place in the new library, this is a perfect mess.

Maybe if you try to recompile the eggs you want to update, then delete the 
old versions of their .so-files and only then install the new .so-files, 
your processes will keep running without segmentation faults, if you are 
using a POSIX system.

To actually have your processes use the new library versions, though, 
restarting them is probably unavoidable.

cu,
Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]