folly
folly copied to clipboard
Mark SharedMutexImpl with FOLLY_EXPORT (#1558)
When accessing a folly::SharedMutex instance from multiple DSOs and program and folly compiled with -fvisibility=hidden, a deadlock is seen when at least one thread is attempting to acquire a write lock.
Backtraces suggest that the writer is waiting for some outstanding reader to unlock; but no such reader appears to have the lock acquired. In actual fact there's multiple copies of the (supposedly singleton) deferredReaders array, one per DSO, it has hidden (local) visibility. This essentially corrupts the details of which readers are outstanding.
Fix by flagging SharedMutexImpl as FOLLY_EXPORT - meaning it has weak linkage and hence only a single instance will be present in memory at runtime.
Fixes: https://github.com/facebook/folly/issues/1558
Is this still a problem? After 5d1b9736e1d3b0bfb339ccea665d3be0e8efab65 in particular.
Hi @yfeldblum, sorry for the slow response; this got forgotten about in the Inbox.
I'm not sure, but based on the linked patch it's probably not an issue now. I'll try to get some time to update my reproducer and re-run with latest folly in the near future.
Stale - closing (I'm no longer working on a project depending on Folly).