It is not clear that this issue is due to lcms. The application seems
to be using OpenMP and is likely using lcms to perform transforms
using multiple threads. The multi-threaded nature may explain why
behavior has not been consistent.
In my experience, it is not safe to create lcms tranforms in threaded
context with lcms 1.X and it seems that ufraw may be doing that. The
thread safety issues are related to the profiles used. Perhaps lcms2
does better at this since it tries to be more thread safe but I have
not tried that yet. It is possible to build a thread-safe lcms but
then it will run like a turtle.
Although it is considerable work to get set up, I recommend using
Valgrind's "helgrind" mode to verify concurrency in the program. Any
shared variables accessed without the protection of a lock will be
reported. The reason why this is considerable work to get set up is
that one must replace the system libgomp.so with one built with one
from the same GCC release but configured to use POSIX threads rather
than Linux-specific interfaces. The results can be quite revealing
and are worth the effort.