Friday, 24 April 2015 00:00

Development: Java RE 7. Back to the future!

Written by 

Trying to fix Java 7RE support in ReactOS led us to find several bugs in a row.
First we found ourselves a "big" bug when installing Java 7 which was making ReactOS to show a nice-bluish window of death. We, then, decided to check if Java 6 was installing and running, and while it installs, was suffering a big memory manager bug: The Pool bug.
Now, once the Pool bug is fixed, it's time to "go back to the future" and check again the Java 7RE setup issue.

The Setup Issue

As you may know the installer of an app is absolutly independent of the app itself. So in order to make Java 7RE working, you have first to deal with the "Java RE 7 installer.exe" and then with "Java.exe" itself.
When we tried to install JRE 7, the setup seemed to work pretty well until it reached the final stage.
During this final stage, JRE 7 installer was trying to copy several data into the ReactOS registry, but instead it was pushing ReactOS to crash in a beautiful blue window.

The only way to retry the setup is to reboot ReactOS, but this bug was so cumbersome that was making ReactOS totally unbootable.
As a result, JRE installer revealed a bug which does not just let JRE to be properly installed, but also trashing the whole ReactOS.
You can find hereone of the reports about this issue, full of debuglogs and potential guesses about what was going on.

A Registry bug

If an app installer crashes while writing registry entries, well, then It's easy to suppose that the bug is hidden in one of our registry apis. If the bug also prevents ReactOS to be booted, then, we're talking about Registry Corruptionwhich is a way more important bug (as important as preventing ReactOS booting at all!).

The Registry is, simple speaking, a...mmm..."tree" of folders and values. Corrupting the registry is not just "not copying" a value, but also modifying this tree in a wrong way so it can lead to "whoknows" behavior, in this case ReactOS not booting.

The Registry Tree..war!

The Test Case

Thanks to several debugging sessions, V and Vicmarcal(well, yes, that's me), found what was going on.
For such, we analyzed the JRE7 installer behavior in Windows 2003, focused in the "Copy values to Registry" stage.
There we detected that JRE installer was trying to remove a registry key under CLSID (one of the "branchs" of the Registry "tree").
We created a first testcase which mainly was creating and then removing a subkey in CLSID, however the testcase wasn't breaking nor corrupting ReactOS at all as we'd expect.

Our second try was more succesful, we created a testcase which was creating 10.000 subkeys and deleting all but the Child5000. This trashed ReactOS in the exactly same way JDK was doing! Exciting!

The idea of creating 10000 subkeys was due CLSID is one of the most populated "branchs" of the tree, so instead creating just one subkey, we tried creating 10000 to replicate as much as possible our CLSID-fake.

You can see here the bugreport with the testcase. The patch there is not the patch of the bug, but a patch to add this testcase into our apitests system so we can track that this bug never "comes to live" again.

Ok. Ok. But...where is the bug??'ll have to wait 'til the next time!
Be prepared to be introduced to "leaves" and "trees"!

Víctor Martínez

Víctor Martínez is the current ReactOS PR Team coordinator focused in partnerships and win-win strategies. After funding his own strategy company, he has been working as an operations and strategy advisor for several companies based in Russia, USA, and Europe. When he is not transforming Weakness into Revenue Streams, he is messing and breaking ReactOS Code.

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.