Fighting the "Spinlock Called When Not Threaded" Error
Now most of you are probably reading the title of this post saying “what in the hell is Athayde talking about?” Well, it’s complicated. But it’s an error that Justin and I have both hit and I keep forgetting to write down how to fix it. So I’m writing it down.
It was a relatively quiet Saturday night, and I was working on cleaning and recovering with some nice Knob Creek and
Code Coke when suddenly, a shot rang out, a door slammed, the maid screamed! Suddenly, a pirate ship appeared on the horizon! Justin posted to Twitter that he was fighting with rMagick on Athena (our main production server). So I offered to help. Diving in we hit this error:
Fatal error 'Spinlock called when not threaded.' at line 83 in file /usr/src/lib/libpthread/thread/thr_spinlock.c (errno = 2)
Hmm. Looked familiar. Hit this before, we have. So I began to dig around. Upgraded ImageMagick to 6.3.3. Nope. rMagick from source! Nope. “But yay for new software,” I said jovially. Hankins was not amused. He found some google fu that started to point us in the right direction. Eventually we found out what it was.
Libraries compiled against other libraries that conflicted with each other and refused to play nice. For those of you who are looking for the fix, here it is. You need to create and hack
/etc/libmap.conf to say this:
- candidate mapping
libpthread.so.1 libpthread.so.1 # everything uses ‘libpthread’
libc_r.so.5 libpthread.so.1 # everything that uses libc_r
libc_r.so libpthread.so # now uses libpthread too!
And then the rmagick
make install commands ran perfectly fine. And everyone was happy.
The young intern sat by himself in one corner of the coffee shop. he had learned about medicine, but more importantly, he had learned something about life.