LD_PRELOAD with .init_array: fatal runtime error: thread::set_current should only be called once per thread

I suppose something in the std IO machinery is using ReentrantLock, if this is actually the correct cause? Although that's purely just a guess.