Thursday, July 15, 2010

Very bizarre problem when running JDK 32 bit on a 64 bit Linux box

I just noticed a very weird problem if you use a 32bit Sun JDK on a 64bit RedHat Linux.

The "user.home" system properties, returned by System.getProperty("user.home"), has the value of "?". Same thing happens with "user.name" property.

I'm not sure why this is but seems like a bug too me.


-bash-3.00$ /shares/jdk/hotspot1.6.0_16/bin/java ShowSystemProps | grep "user"
user.country = US
user.dir = /home/hhuynh
user.home = ?
user.timezone =
user.name = ?
user.language = en


Correct values if I used 64bit JDK


-bash-3.00$ /shares/jdk/hotspot1.6.0_16_x64/bin/java ShowSystemProps | grep "user"
user.country = US
user.dir = /home/hhuynh
user.home = /export2/homes/hhuynh
user.timezone =
user.name = hhuynh
user.language = en


This bug leads to Maven creating the local repository under the current working dir: "./?/.m2/repository" and leads to many confusing problems down the road.

9 comments:

Roger Y said...

Hello,

I tried a 64-bit RedHat 5.2 and a SUSE 11 with Java 6 update 16, but I cannot reproduce the issue.

Can you reproduce this on other machines?
Can you reproduce the issue with latest release, 6u21?
Here's my code snippet:
...
Properties props = System.getProperties();
props.list(System.out);
...

Thanks,
Roger Y.

hhuynh said...

Hi Roger,

Yes I could reproduce with 6u21 on the same box and in a different box. I've also printed out the box 'uname -a' below so you could have some reference. Also another note, my login is a network login (ie I can use the same credential to login any boxes at my work)

[hhuynh@dev02:~]$ java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

[hhuynh@dev02:~]$ java ShowSystemProps | grep "user"
user.country=US
user.dir=/home/hhuynh
user.home=?
user.timezone=
user.name=?
user.language=en

[hhuynh@dev02:~]$ uname -a
Linux dev02 2.6.9-78.0.13.ELsmp #1 SMP Wed Jan 7 17:45:52 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

hhuynh said...

Hi Roger,

Yes I could reproduce with 6u21 on the same box and in a different box. I've also printed out the box 'uname -a' below so you could have some reference. Also another note, my login is a network login (ie I can use the same credential to login any boxes at my work)

[hhuynh@dev02:~]$ java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

[hhuynh@dev02:~]$ java ShowSystemProps | grep "user"
user.country=US
user.dir=/home/hhuynh
user.home=?
user.timezone=
user.name=?
user.language=en

[hhuynh@dev02:~]$ uname -a
Linux dev02 2.6.9-78.0.13.ELsmp #1 SMP Wed Jan 7 17:45:52 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

hhuynh said...

More info on that RedHat box

[hhuynh@dev02:~]$ cat /etc/redhat-release
Red Hat Enterprise Linux ES release 4 (Nahant Update 7)

I can't reproduce it on a Suse 10 box with 6u21. It works fine there

Roger Y said...

can you verify if the network login is the issue? can you please try with a local account on the same machines?

Roger Y said...

Can you please run strace -f java -version and submit a bugreport to http://bugs.sun.com? Please post back the incident number so I can take a look at the issue.

It may be because you use NIS or LDAP and doesn't have the 32-bit libraries... my guess is something about your environment.

Thanks,
Roger Y.

hhuynh said...

I filed a bug at the above link but didn't get any email confirmation with the bug number. After submitting the bug, the page doesn't show the bug id either so I'm not sure what to give you.

JDK 6u21 32 bit does work correctly with a local user. The trace you asked for can be found here http://pastebin.com/6qr0XjLn (I also attached it to the bug report)

hhuynh said...

finally got a bug ID today from email: Bug Id: 6972329

Roger Y said...

I have opened a bug report to track this issue. Bug ID: 6972329.

It will take a day or 2 for the bug to show up in the external site.

Thanks.