Posts

Showing posts from April, 2007

Exception in "CompilerThread0" java.lang.OutOfMemoryError

Ever since we switched out build process from Java 1.4 to Java 5 (1.5.0_09) we have seen FindBugs crash with an OutOfMemoryError when started from ant. The whole thing is running under RedHat Enterprise Linux 4. The output is always the same: [findbugs] Running FindBugs... [findbugs] Exception in thread "CompilerThread0" java.lang.OutOfMemoryError: requested 134217736 bytes for Chunk::new. Out of swap space? Our first attempts to increase the heap size with the -Xmx VM parameter did not help. We suspected the newer FindBugs release we had installed roughly at the same time, but this turned out to be wrong, because newer and older versions showed the same behaviour.Armed with the freshknowledge about the SAP Memory Analyzer just learned at jax.07 I tried to get a heap dump to try and find out what was causing the problem. Unfortunately the VM ignored my -XX:+HeapDumpOnOutOfMemoryError option completely (on Sun's VM Options page there it says -XX:-Heap... (with a minus), …

jax.07 Day 3

The (my) last day of jax started with Oliver Stauss talk "Umstellung eines Projekts von Ant zu Maven 2", dealing with switching a project from ant to Maven 2. For my taste there was too much history of Maven and too little concrete examples. I do get the impression that many speakers tend to go slow at the beginning of their sessions, elaborating too much on why and when the world was created, how mankind came about and suddenly realize that they have to hurry up to finish in time. Sorry Oliver, this is nothing personal, but a general observation I have made. But I am sure the session (which was good nonetheless) could have been a little more juicy had the focus been put differently. To my delight the first keynote of the day, "The Role of Java EE in Enterprise SOA development at SAP" was not the self-adulation and buzzword-bristling thing I almost expected it to be. Instead it was quite interesting to hear about Java delopment in such a big company. Everything see…

jax.07 Day 2 (cont'd)

Adam Bien's talk about almost forgotten technologies in the Java world turned out to be rather boring, even though he introduced it as a "fun talk". He shortly mentioned FreeTTS and Sphinx and then talked a lot about JINI and some surrounding technologies. After only about 30 minutes the talk ended very early. Even though this gave me time for some fresh air, from retrospect I would better have spent the time in a different session.I also skipped the keynote about Microsoft's Security Development Cycle. Somehow I was not too eager to learn about a security strategy of someone who has not proven to be a leader in that field.Later that day I attended ""3D-Rendering and Physics Engines with Java SE 6" by Michael Bien (Adam Bien's younger brother). While the demos were impressive, Michael still has to practice a little more on how to speak freely and fluently to catch up with his brother :)The second 30 minute short talk was Anrew Overholt's (Red H…

jax.07 Day 2

This morning my initial session was "Design Patterns for Security", held by Bruce Sams. I do not know whether it was too early for me or the topic was really that boring. While the ideas presented were not wrong or unusable they however where not really new. So I really had to concentrate too keep listening, waiting all the time for the moment the talk would finally take off for me. It didn't. And in retrospect I believe much of what I heard was already said at last years session, just under a different title.The second talk was Dierk K√∂nig on Groovy. At the very beginning we moved from the originally planned room to the main hall, because there were too many people there to pack into the small conference room. This cost about 5 minutes, however Dierk nicely compensated. For me personally I did not learn anything new, because the talk was obviously intended to inform people about the language that had not heard about it before. Nevertheless the talk was good and the exam…

jax.07 Day 1 (cont'd)

Alright, yesterday's memory analysis talk was not that bad in the end. In fact their tool has its advantages over the usual suspects (at least I have never tried to load a 6GB 64bit heap dump with one of the tools I know). Apparently it only needs a somewhat powerful machine to initially parse the dump and generate some indices, but after that, any decent 32bit machine will work for the analysis. I will probably give it a try when I am back at work - "fortunately" we have been seeing some OutOfMemoryErrors while using FindBugs from the ant build. Maybe this can give us an idea.Todays final session - after the "Web 2.0 and SOA" keynote (anyone else tired of hearing this everywhere?) was called "Schweinkram: Abstrakte Klassen dynamisch generieren" ("Nasty stuff: Dynamically generating abstract classes") by Michael Wiedeking. This one was really great. Not only was the topic very interesting, but the speaker was also presenting it in a very hum…

jax.07 Day 1

Today jax.07 started (at least for me). After a somewhat boring opening speech and an (almost equally boring) keynote by Sun's Tim Boudreau titled "Using the Right Tool for the Job" I went to "Schneller fahren auf mehr Spuren? Multithreading im Zeichen von Mehrkernprozessoren" ("Driving faster on more lanes? Multithreading in the light of multi-core processors"). It was quite interesting although the title was a bit misleading. I would have called it something like "Introduction for JDK5/6 concurrency".The next session was "Performance Anti-Patterns" by Mirko Novakovic which was quite worthwile. While not presenting much new information for me it at least reassured me that you are never alone with your problems and that other people are not necessarily better off :) Once again I saw a demo of PerformaSure which seems to be a useful product. If only it were not so expensive.Lunch was surprisingly good, remembering last years bad exp…

jax.07

Tomorrow I will be leaving for Wiesbaden to attend jax.07. I am looking forward to see a lot of good talks and some people in person who you read so much about (or from them for that matter). I think it is one thing to have a few books on the shelf with names like Brian Goetz on them or having seen them on some videostream. But I believe it's a different thing to actually see them in person.After my experience with the food last year I will probably go outside for lunch. The venue is very close to a pedestrian precinct, so there should be ample opportunity to keep away from gastrointestinal disorder this time :)

Upgrade to Feisty Fawn

On Thursday I downloaded the Feisty Fawn alternate CD from Ubuntu.com for a distribution upgrade. Because I did not have the nerve to first burn a CD I just loop-mounted it to /cdrom and started the upgrade.Just like last time it went off to download another 350MB from the net. Once that was done it started installing the new packages. On the way it asked questions on some packages - I would have liked this to happen first, so that I could have let it run unattended. In all it took about 2 hours before it asked me to reboot.I did so, just to look at the nice bootsplash and then be confronted with a message about a non-functional X11. On the command line I quickly realized that it was the same problem that I have had before several times: it had not installed the necessary linux-restricted-modules-generic package for the new 2.6.20.15 kernel, needed for my GeForce card.Using aptitude I installed it and rebooted. This time I could log in to X. I had hoped that such problems were a thing…

Something to know about Toshiba external USB HDD

As I wrote before, luckily I bought an external hard disk and started backing up my data just in time. Well, although this may look like talking bad about good things, I still believe I should post this. The drive model I bought is a Toshiba PX1269E-G50, a 500GB external USB 2.0 model.On the box it says this: Optimized for digital video, photos and music storage. Fanless design for near-silent operation. Interface: high-speed USB 2.0. Interface transfer rate (max.): 480 Mbps. Rotational speed: 7200 rpm. Cache: 16 MB. PushButton Backup. Password security. System requirements: PC with minimum 233 MHz pentium or equivalent (Celeron, AMD, etc.), Windows 2000/XP, available USB 2.0 port. I read this before buying in the store. I did not care for whatever "PushButton Backup" is. I still don't. I did not care for Password security. I still don't. It says Windows 2000/XP, but after all it is a USB mass storage device. Not needing the nifty Windows backup or security tools I d…

FindBugs - Writing custom detectors (Part 1)

Some words in advance...Recently I wrote about multi-threading problems with java.util.Calendar and java.text.DateFormat. The last sentence was So maybe it is time to search your code for all static usages of the Calendar and various ...Format classes, before you start getting strange errors.Searching code is not very practical, especially if you do it manually. Everyone knows you can look at code for hours, without seeing an problem - and as soon as it has reached production systems it starts breaking up in various ways :-)Fortunately smart and reknown people have devised ways of making the computer look for bugs automatically. Amongst others, FindBugs is a very nice - and free - tool that analyzes your Java application's compiled bytecode and looks for numerous so called bug patterns. Those patterns are divided into categories, such as "Bad practice", "Correctness", "Multithreaded correctness", "Performance" and some more. Each of them lo…

Backup... Just in time

Even though I intended to write about something completely different (the first FindBugs bug detector I wrote), I decided to put this first, because of it having been more "important" to me in the last week.Some background: About three years ago my girlfriend's notebook drive crashed. Even though she insists it was my fault, because I was using the computer at the time, it was the first hard drive in my immediate surroundings that actually had a real hardware defect. Call me lucky, but in all the time back to my first HD (must have been around 1992) I never really saw a broken hard drive.Back then I was concerned about my own data and started backing up my files to DVDs. However I - as probably anyone does - soon grew tired of burning new disks, because the time never seemed to be right. Either I had not really changed too much, or there was simply no time to do it. So soon I forgot about it again.Three weeks ago I heard about from a colleague that in one weekend he had …

BumpTop 3D Desktop

A colleague pointed me to a very interesting website about a project that aims to enhance the desktop experience by utilizing state of the art 3D technologies: http://www.bumptop.com. The basic idea is Enriching the Desktop Metaphor with Physics, Piles and the Pen. Go to the site to read more, they provide some papers about their work and offer to subscribe to a mailing list.For the impatient: Here is the "official" YouTube demonstration:

Calendar, DateFormat and multi threading

Another anecdote from the ongoing Java 1.4 to Java 5 transition... Last time it was an incarnation of "Favor composition over inheritance". This time I am writing about a multi-threading issue which can be equally subtle and difficult to pinpoint.On the test systems we have set up we observed two strange types of exceptions at seemingly random times and in various different areas of the application. They looked similar to the following two patterns: java.lang.ArrayIndexOutOfBoundsException: 432 at sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate(BaseCalendar.java:436) at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2024) at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1941) at java.util.Calendar.setTimeInMillis(Calendar.java:1066) at java.util.Calendar.setTime(Calendar.java:1032) ... (our classes) java.lang.ClassCastException: java.util.SimpleTimeZone at java.util.Calendar.wr…

Composition over Inheritance... again

After what seemed like forever we have now finally begun to migrate our product from Java 1.4 to Java 5. Java 6 would have been nicer, but that is another story.The first step was of course to switch compilers, runtime environment and Eclipse's source compliance settings. What followed were the usual suspects before we could compile again (uses of e. g. enum as a variable name, different package names in the XML area that bit us because of not using Factories etc).However one thing did go unnoticed and was only found some days on a test system because of strange data-truncation warnings. For some reason negative numbers were too long by 1 digit. To understand this one has to know about a rather old data exchange format we need to support. It's string-based with leading zeros for numbers. Interestingly you can send a number like 99999 (positive), but only -9999 (negative), because there is a maximum length of 5 characters in the format.The JDK's DecimalFormat almost does t…

Google Code Prettify

While working on a completely different post regarding subtle bugs surfacing in a Java 1.4 to 5 migration, I asked myself whether there was simple way of getting code samples to be syntax-highlighted on my blog. Pure CSS would not work, unless the code samples were completely messed up with spans and divs to indicate which style to apply to every word, number or punctuation.This could have been done with tools like Java2Html, but it generates lots of font tags instead of CSS based style instructions.Looking around I found Google-Code-Prettify, a combined JavaScript and CSS solution to my problem. It turns out to be very easy to use, you just have to specify a class="prettyprint" to your pre blocks and activate the JavaScript via the body tag's onLoad hook. It will then try and guess which language any "prettyprinted" pre block contains and format it according to a stylesheet you may modify to fit into your site's layout. The number of languages recognized i…