March 13, 2007
APE and Rosetta: The Battle's Done and We Kind of Won So We Sound our Victory Cheer

Note: This post only applies to Mac OS X 10.4.9 for the ICBMs. Since the PowerPC-based Macs cannot run Rosetta, none of the below is applicable to the PowerPC-based Macs.

Good news everyone. Mac OS X 10.4.9 has finally been released. This release fixes a major bug in Rosetta that caused PowerPC applications to crash. This was especially true if APE was installed. Although APE didn't cause the bug, it did trigger it the far majority of the time. I guess it should be mentioned that this bug happened on some people's Macs without APE having ever been installed.

But Mac OS X 10.4.9 fixes the bug, so it's cool.Why is the path unclear when we know home is near?

It's kind of funny, really. This bug was introduced sometime between Mac OS X 10.4.5 and 10.4.6 for the ICBMs. We thought that Mac OS X 10.4.7 would fix it based on some rumors on the internets. We were actually holding back a lot of releases hoping that the bug would be fixed. Sadly, it did not get fixed when Mac OS X 10.4.7 was finally released. I think we all cried in a circle or something.

When Mac OS X 10.4.7 was released and it didn't fix the bug, we had to make a decision. Customers were complaining about applications running under Rosetta crashing. We had an ugly temporary fix (that involved killing translated) but that was too ugly. So we made our choice.

Understand we'll go hand-in-hand while we walk alone in fear.

The "horrible" workaround we had was suggested by one of our users. Namely, that calling update_prebinding fixed the problem. Somehow running update_prebinding eventually causes dyld (the craptastic dynamic linker that Mac OS X uses) to eventually call new_system_shared_regions or something like it. This call to new_system_shared_regions somehow seems to have a side-effect of causing Rosetta to ignore its global cache, possibly since there are now two maps of shared libraries on the system. The cache was the root of the problem with Rosetta and APE and it's why killing translated would temporarily fix the issue; it disconnected Rosetta from its cache (and luckily the cache is not needed for Rosetta to work or for it to be fast).

dyld is the only thing that is allowed to call new_system_shared_regions. Updating the prebinding is one of the only easy/non-evil ways to get dyld to call new_system_shared_regions that we could easily find.

So why was update_prebinding horrible? Well, forcibly updating prebinding had a few side-effects.

  1. The smallest issue and by far the easiest for users to notice is that updating prebinding caused a large speed hit for the twenty to forty seconds it ran during each login.
  2. It caused a massive number of files to be added to the disk cache. This meant the amount of free memory as listed in top would be significantly less than it'd otherwise be during a normal login. While this didn't have any actual negative performance effects, a lot of people believed it did (since most people perceive the amount of free ram to be a measure of performance). The files added to the disk cache were immediately marked as stale and would be removed from the cache as soon as that memory was needed by other processes. Those files simply being in the disk cache didn't prevent any other task from using that memory. Mac OS X has extremely aggressive disk caching.

    If you open the Terminal (/Applications/Utilities/Terminal) and run du -s / (which has a side-effect of emptying the disk cache) would confirm that the memory isn't actually "used up". Note that this command can actually decrease performance as it forces all of the files in the disk cache to be removed, which means that they have to be read from disk again the next time they are accessed. Reading from disk is slow.

  3. There is a fixed amount of space available for the memory that stores shared regions. Every call to new_system_shared_regions uses up a chunk of that space. If you run out of space, bad things happen. Such as 1) APE stops working in newly launched applications and 2) Rosetta applications won't launch at all. There's no error or anything (other than in system.log), they just don't launch. Which means, ironically, the problem this workaround was designed to fix comes back with a vengeance. It also meant that repeatedly clicking on "Optimize APE for Rosetta" would just make the problem progressively worse as the amount of space in that memory region is eaten up. Note that this memory is automatically "garbage collected" so if APE isn't working on newly launched applications (when it worked before) or Rosetta applications suddenly don't launch after you've ran update_prebinding a bunch of times, try quitting some memory-intensive applications like Safari and then relaunch them.

Where do we go from here?

Well, first download Application Enhancer 2.0.3. Then run Software Update and download and install the Mac OS X 10.4.9 update. Upon reboot, APE will no longer run update_prebinding.

We will be updating the majority of our haxies to include APE 2.0.3 over the next few weeks. If there are no other small fixes to be made to a haxie and it's one of the less popular ones, we may just do a "silent" update. Meaning all we'd do is download the disk image, set it to read/write, replace the APE installer, set it back to compressed read-only and upload it back to the server without changing the version number.

We highly recommend everyone download Application Enhancer 2.0.3 and Mac OS X 10.4.9.

The curtains close on a kiss. God knows, we can tell the end is here.

Here's looking forward to 10.4.10!

Digg This!

 Posted by rosyna at March 13, 2007 11:36 AM

Trackback Pings:

TrackBack URL for this entry:
http://www.unsanity.org/mt-tb.cgi/414.




Related:
Comments

FIRST POST!!! AND CONGRATS ON WINNING THE BATTLE ROYALE. NOT AS TASTY AS A ROYALE WITH CHEESE, BUT HEY!

Posted by: Rosyna is sexy on March 13, 2007 3:30 PM

Even that the new APE runs faster than 2.0.2, it's still slower than the pre 2.0.2 betas on Intel. Anyways, thank you for your efforts. I'll maybe keep this new one. :)

Posted by: pumpkin on March 13, 2007 4:07 PM

pumpkin, are you sure about that...? Other than the prefpane, this new APE is identical to the pre-2.0.2 betas.... So I'm not sure how one could be "slower" than the other if they're the same thing.

Also, what is "slower/faster" about APE?

And the prefpane isn't even needed for APE to work, it's purely there as a user interface to APE's and APE module's settings.

Posted by: Rosyna on March 13, 2007 4:35 PM

i installed ape 203, updated ws and fm and then installed 1049 on my mbp and when i tried to sart eudora, it never did. neither all other ppc apps. i then tried to do the prebinding thing via ape, no help. then ran sudo killall translated, also did not help!! disabled ape, and all went back to normal.

Posted by: vitaly on March 13, 2007 6:04 PM

then i uninstalled ape203 and reinstalled 202. all was fixed and all apps worked normally.

Posted by: vitaly on March 13, 2007 6:11 PM

reinstalling ape203 (as rosyna suggested) caused ppc apps to not work again. i am posting this here because my direct mails to rosyna are bouncing back (may be because am sending from a hotel in bethesda where i am at a meeting)

Posted by: vitaly on March 13, 2007 6:21 PM

and! ws412 with ape202 does not minimize in place safari but does other apps i tried. curiouser and curiouser

Posted by: vitaly on March 13, 2007 6:26 PM

Thanks for all your work.. I was one of the users who politely asked questions/complained about the update_prebinding process at startup and was unhappy with performance hit (real and perceived).

The folks at this company are remarkable people - they keep on working away and keep on delivering.. a sincere thank you for your efforts for all of us.. please never think yr efforts are not appreciated...or noticed.

Take a bow folks... and listen to the applause

Posted by: Eric Woehler on March 13, 2007 6:33 PM

Eric, I was just about to email you and tell you about this post. I guess it's all good now...?

Posted by: Rosyna on March 13, 2007 7:20 PM

yes, peole are remarkable. most of all rosyna. she fixed this for me. now all work. here is the story: i did install ape203 and ws and fm updates, then right away installed 1049. then REBOOT. this is when rosetta got screwed up. logging out did not help. but ANOTHER REBOOT fixed all. this was suggested by rosyna in the middle of the night (well, almost.. at 10.30 est). thanks

Posted by: vitaly on March 13, 2007 7:22 PM

FWIW: Eudora runs fine for me after updates to 10.4.9 and APE 2.0.3. Rosetta apps also seem to run fine.

17" MBP 2.16 MHz

Posted by: Bonobo on March 14, 2007 5:11 AM

Why don't you submit APE 2.0.3 to Versiontracker? This is indeed big news for APE of course.

Posted by: Ilgaz on March 14, 2007 5:56 AM

THANKYOU for this, Apple guys and Unsanity guys - update_prebinding probably *should* take only 40 seconds to run, but I have a ton of apps and other stuff on my MacBook with only 512MB RAM. The effect of this, along with the dozen or so login items I have, is to make my logins regularly take many minutes to complete - that is, for the hard drive to settle down and everything to get back to normal.

Thanks again Unsanity for bringing this out so soon after 10.4.9 was released - I suppose you have access to the developer seeds.

Sam

Posted by: Sam J on March 14, 2007 10:03 AM

You know, even on PPC units Mac OS X is using from 1/3 to 1/2 of the memory it used in the 10.4.8 release. Seems that they've done some major overhauls with the kernel level perhaps? This is wonderful as we've been miserable through the life of Tiger, even having issues back in ADC beta seeds long, long ago. Any input or insights about this aside from the Rosetta issues which obviously don't affect those using ppc units?

Posted by: ylon on March 14, 2007 12:02 PM

thank you for combining two of my favorite things: unsanity products and buffy. you guys rock...thanks for the update!

Posted by: james on March 14, 2007 12:42 PM

how to get rid of this message?
http://img401.imageshack.us/img401/1973/bild1gk5.png

Posted by: Sin on March 14, 2007 2:44 PM

Sin, just click the "Preview" button. Then the message goes away.

Posted by: Rosyna on March 14, 2007 2:49 PM

i know... but every preview it pops up again...
what i want to know is, can i use all my old themes without problems or should i wait for shapeshifter update?

Posted by: Sin on March 14, 2007 3:06 PM

Well... I just updated to 10.4.9 and I haven't yet reenabled APE.

But I'm unable to launch Rosetta applications within about an hour of a restart.

So, things are back to where they were *with APE* only now I'm running 10.4.9 *without*. Any suggestions?

... desparate ...

Posted by: dave on March 14, 2007 5:28 PM

dave, I guess restart. Check the system.log for a message about shared regions when you try to launch a rosetta app. If you see a message about shared memory/regions, it's the #3 thing listed about prebinding above. You can attempt to do the same things #3 suggests or you can just reboot and pray to your various gods.

Posted by: Rosyna on March 14, 2007 5:41 PM

" If there are no other small fixes to be made to a haxie and it's one of the less popular ones, we may just do a "silent" update. Meaning all we'd do is download the disk image, set it to read/write, replace the APE installer, set it back to compressed read-only and upload it back to the server without changing the version number." -- Then how will users know that these updates have been made??? Aren't you planning on any scheme of announcements at all?

Posted by: Dana Sutton on March 15, 2007 12:21 AM

Dana Sutton, they can subscribe to our haxies announce mailing list (http://www.unsanity.com/list/) and will get the notification that way.

Posted by: Rosyna on March 15, 2007 12:28 AM

*sarcasm*

Rosyna please don't post stuff uncovering OS X bugs or joke with Apple like that.

See what happens if you do :)

http://arstechnica.com/journals/apple.ars/2007/03/14/unsanity-updates-utilities-application-enhancer-unsupported-by-apple

This blog should consist of posts relating how great iPhone is, how excellent Intel processors are and of course don't forget the "Wii".

You should rarely post entries about the technical magnificent features of OS X so in Leopard we may even see APE gets bundled with macs!

Posted by: Ilgaz on March 15, 2007 4:58 AM

rosyna,

thanks for your helpful tips. unfortunately my despair deepens. i mentioned above the now rosetta apps don't launch. since then i've re-installed mac os x 10.4.9 with the combo updater, i've cleaned caches using tiger cache cleaner, i've updated pre-bindings, and i've quit memory hogging apps like safari.

yet, when i try to launch rosetta apps, after a while they insist upon crashing before they're able to bounce even once in the dock. i get the "kernel[0]: shared_region: 0x40be3d0: lsf_map: unable to allocate entry" error message in my system.log

oh woe. i just can't restart my mac whenever i need to use a rosetta app. but that seems to be the only thing that works, and it only works for a while

the irony is that i had everything working again in 10.4.8

if anyone has any thoughts, i'd be appreciative

best, dave

Posted by: dave on March 16, 2007 9:01 PM

Hi all, I like how Bonabo had no problem with Eudora after updating to Mac OS 10.4.9--I also had no problem until I chose to update my dot.macsomething passwords, mainly to make the dialogue box go away. Maybe that was not a good idea as now Eudora cannot access my comcast server. Does anyone know how to fix that...can't see any changes to my Eudora send/receive mail preferences.

Thx from a techno idiot, ((but I can follow directions USUALLY)) please blog...

Posted by: Liz on March 20, 2007 1:23 AM

OK---well, within minutes of posting, my Eudora problem is suddently resolved! Apparently this blog is bestowed with psychic capabilities. Thanks so much, oh unsanity site.

Posted by: Liz on March 20, 2007 1:46 AM

LOL! Not only am I happy the issue is resolved, but am I the only one to appreciate the use of "Where Do We Go From Here?" from "Once More With Feeling" from Season 6 of Buffy??? Brilliant. just brilliant!

Posted by: Mith Barnes on April 8, 2007 11:07 AM

I am on a non-intel imac g5. 10.4.7 build 8J135

i haven't updated to 10.4.9 because I have read about way too many problems w/ it at places like macfixit pro.

i have ape 2.0.2. do i need to update to 2.0.3?

thanks

Posted by: CC on April 18, 2007 12:15 PM

Note for CC:

I too have iMac G5. I was on 10.4.7 for a long time, did the update to 10.4.8 and ran on it for about 6 months without any problems I could attribute to it. I also waited a while to read up on 10.4.9

I finally decided to update to 10.4.9 and used my 'special' safe update method. Main things are:
1) do a HD disk repair by either booting from another drive, partition or Apple Tiger install CD and run Disk Utility.
2) repair permissions on the boot drive
3) for good measure, I run a clean cache files utility
4) fresh reboot, almost ready
5) only have primary apple physical devices plugged in (no ext HD, etc)
6) run combo updater (it usu gives better results, even if only going from one dot to next upgrade) - and no other programs while updating system
7) after done, run repair permissions and HD disk repair
8) reboot - I usu do a PRAM reset (boot, hold Cmd-Opt-P-R till three chime cycles).
9) Replug in my devices and go.
(every once in a while, it seems that it takes a second boot after the whole process for system to act well and smooth)

10.4.9 seems to be working well for me these last 3 weeks.

Best.

[aside, I used to think - so why am I waiting to install an update a while after it comes out? does it get better with its age? no, it just gives me time to read up on it and see if any special reason to avoid it, or special way to install, or if Apple were to issue a ....1 updater]

Posted by: Behere on April 18, 2007 1:44 PM

Behere, don't forget to sacrifice a chicken between each step.

The far majority of your steps (1, 2, 3, 5, the rationale for 6, 7, the latter of 8, the rest of 9) are just completely useless busy work and are based on specious reasoning.

You're also doing actions that are automatically done by the install process for what seems like no other reason than to do it.

The only reason 5 is even partially valid is because a bad device can cause the boot process to stall while the system tries to initialize it. If the device is really, really bad, then it can cause a kernel panic on boot. I'm not suggesting that everyone should disconnect all devices before rebooting, I'm suggesting that people don't buy bad devices. A bad device (especially if it is USB) can lead to problems even after boot.

Posted by: Rosyna on April 18, 2007 2:19 PM

I hope the updates plug the memory leaks I'm seeing with APE/WindowShadeX (not sure which). If I run leaks on any program, i see many many instances of:

Leak: 0x08ecde70 size=48 string 'com.unsanity.windowshadex.reg'

Posted by: Nik on May 3, 2007 4:51 PM

Belay that. I just found I had something weird with my installation, and reinstalled the latest version of WindowShadeX. The leaks appear to be gone now.

Posted by: Nik on May 3, 2007 5:18 PM
Post a comment




Remember Me?

(you may use HTML tags for style)