From: Marc <ma...@da...> - 2008-09-25 19:18:03
|
Hi folks, after updating to Mac OS X 10.5.2 I experienced a huge problem with iTerm on my MacBook Pro (but not my iMac at work): after starting up iTerm hung up. The UI rendered, but upon trying to render the session nothing happened. I then got the latest CVS version, but with the same problem. But in XCode I saw an error message regarding a deadlock in NSLock: Thu Sep 25 20:34:52 neotokyo.local iTerm[14091] <Warning>: CGSResolveShmemReference : reference offset (65296) exceeds bounds (32768) on shmem obj 0x2f69 2008-09-25 20:34:52.793 iTerm[14091:10b] Error (1000) creating CGSWindow 2008-09-25 20:34:52.806 iTerm[14091:10b] *** -[NSLock lock]: deadlock (<NSLock: 0xfcccc0> '(null)') 2008-09-25 20:34:52.806 iTerm[14091:10b] *** Break on _NSLockError() to debug. But it turned out that the deadlock was only the symptom, not the cause. After some googling, it seems that the "Error (1000) ..." stuff is a bug in Mac OS X 10.5.x. It's running inside code that is started with a [VT100Screen tryLock]. Because of the exception, the corresponding [VT100Screen releaseLock] is never called. Then the same thread later tries to run [VT100Screen acquireLock] and there you have your deadlock. I traced the exception to PTYTextView::_renderChar (how do you write that in Objective-C syntax ?), more precisely to [image lockFocus]. The attached patch works around the bug by packing the [image lockFocus] into a @try @catch block. It retries the lockFocus up to five times. If that still does not work then the exception is rethrown. That fixes the hang problem for me. Bye, Marc |