GNOME Bugzilla – Bug 81076
fork() is not handled
Last modified: 2004-12-22 21:47:04 UTC
gnome-vfs doesn't seem to handle fork(). It needs to use pthread_atfork() so that the mutexes are OK in the child process (i.e. not locked forever). The glibc info docs contain a section about this. It also probably needs to do something about the job table and the state of any operations underway. Maybe just clear them in the child process. The other alternative is to say 'gnome-vfs will not work across a fork()', which is OK, as long as it is documented somewhere. (Nautilus thumbnailing code seems to assume it does work across fork() at present. Bug #78542 may be related to this.)
I just discovered that POSIX says a forked child of a multi-thread app is only supposed to use asynchronous safe functions. From glibc info docs, POSIX threads/Streams and fork: "Also note that these provisions are a GNU extension; other systems might not provide any way for streams to be used in the child of a multithreaded process. POSIX requires that such a child process confines itself to calling only asynchronous safe functions, which excludes much of the library, including standard I/O." So it looks to me like gnome-vfs can't reliably be used across a fork anyway.
I'm documenting this limitation.