Tag: java

Issues Running Java Programs Remotely via X

Recently I started using SmartSVN running remotely on a Solaris 10 server and displaying on my Windows XP machine via Xming (the free Xserver). I quickly ran into some performance and usability issues which I hope to have solved.

  • Performance:
    1. Xming uses OpenGL for rendering by default. I added the following option to the java command line: -Dsun.java2d.opengl=true
      I’m not sure this technically made a difference but a developer claimed a 300% performance increase??
    2. Since I am working over a LAN, I disabled compression for the SSH connection being used to tunnel X and set my preferred cipher to Blowfish. Again- I’m not sure this made a difference but theoretically it should be faster.
  • Usability:
    1. There is an apparently known issue with running Java programs via X which causes all sorts of problems in painting the windows correctly. In my case, the mouse position was being shown in one place but the menus were being highlighted about 50 pixels lower. It took me a while to find it in this postabout Swing on Remote X and this related post about cursors and menus in NetBeans. Of course, after finding it in Google, I found the following comments in the SmartSvn start script:
      # If you experience problems, e.g. incorrectly painted windows,
      # try to uncomment one of the following two lines
      #export AWT_TOOLKIT=MToolkit
      #export AWT_TOOLKIT=XToolkit

      Uncommenting the export AWT_TOOLKIT=MToolkit did the trick. Now the menus are much more responsive and the cursors show in the correct position.

I’m not sure if the problem here is in XToolkit or in SmartSVN. I’m also not sure what this will mean in future versions of SmartSVN. Apparently JDK7 will not support MToolkit so either XToolkit has to work properly by then or SmartSVN has to be fixed to use XToolkit properly.

Webservd Default Home Directory

Someone currently building an internal development environment required some integration between servers using SSH and the webservd user.

He came to me when he saw that the default home directory for the webservd user is /.  He didn’t want to create a /.ssh/authorized_keys file and I didn’t blame him. My first reaction was to change the home directory but I didn’t want to break something so I opened up Google and found something incredible.

DISCLAIMER: The following is quoted from documentation at docs.sun.com (emphasis is mine). I do not recommend you actually listen to it’s instructions:

If the runtime user of the OpenSSO Enterprise web container instance is a non-root user, this user must be able to write to its own home directory.

For example, if you are installing Sun Java System Web Server, the default runtime user for the Web Server instance is webservd. On Solaris systems, the webservd user has the following entry in the /etc/passwd file:

webservd:x:80:80:WebServer Reserved UID:/:

The webservd user does not have permission to write to its default home directory (/). Therefore, you must change the permissions to allow the webservd user to write to its default home directory. Otherwise, the webservd user will encounter an error after you configure OpenSSO Enterprise using the Configurator.

Did someone actually write in documentation to give the webservd user write access to / ?!?!? What were they thinking?

Cisco ASDM unconnected sockets not implemented

Cisco ASDM recently started giving me the following error: unconnected sockets not implemented.

After checking around, it seems that this is a known issue with newer Java releases, specifically the current version seems to require JRE 1.6u7.

Downgrading is an option but it is unnecessary. Instead open the Java control panel (Control Panel -> Java -> Java tab) there is a section “Java Application Runtime Settings”. Click View.

This dialog controls which JVMs will be used when using JNLP (Java Network Launch Protocol). This is the technology behind the Cisco ASDM Java Applet. Uncheck the newer JVM versions and run the ASDM applet from the Cisco ASA web interface… this fix will not work with the ASDM Launcher.

This way you can still use the newer JVM for most applications, even re-enable/disable them for JNLP as needed.

Sun Apache2 breaks PHP?

This post isn’t going to solve anyone’s problems but maybe someone will solve mine.
I recently compiled and packaged a new release of php4 (4.4.7) for use with Sun’s Apache2 (Solaris 10 11/06 patched).
Unfortunately for some very strange reason, Apache segfaults whenever it tries to server a page. It segfaults even if the page has no php involved and only if the php module is loaded.

Here is some sample truss output:

2146:   stat64("/var/apache2/vservers/htdocs/favicon.ico", 0xFFBFF720) Err#2 ENOENT
2146: lstat64("/var", 0xFFBFF720) = 0
2146: lstat64("/var/apache2", 0xFFBFF720) = 0
2146: lstat64("/var/apache2/vservers", 0xFFBFF720) = 0
2146: lstat64("/var/apache2/vservers/htdocs", 0xFFBFF720) = 0
2146: lstat64("/var/apache2/vservers/htdocs/favicon.ico", 0xFFBFF720) Err#2 ENOENT
2146: Incurred fault #6, FLTBOUNDS %pc = 0xFE887CF8
2146: siginfo: SIGSEGV SEGV_MAPERR addr=0x00000054
2146: Received signal #11, SIGSEGV [caught]
2146: siginfo: SIGSEGV SEGV_MAPERR addr=0x00000054
2146: schedctl() = 0xFEE06000
2146: lwp_sigmask(SIG_SETMASK, 0x00000400, 0x00000000) = 0xFFBFFEFF [0x0000FFFF]
2146: chdir("/usr/apache2") = 0
2146: sigaction(SIGSEGV, 0xFFBFF2B8, 0xFFBFF358) = 0
2146: getpid() = 2146 [912]
2146: getpid() = 2146 [912]
2146: kill(2146, SIGSEGV) = 0
2146: setcontext(0xFFBFF298)
2146: Received signal #11, SIGSEGV [default]
2146: siginfo: SIGSEGV pid=2146 uid=80

I configured Solaris to dump core and gdb’d the core file:

#0  php_handler (r=0x1964e8) at /root/dev/php-4.4.7/sapi/apache2handler/sapi_apache2.c:470
470 /root/dev/php-4.4.7/sapi/apache2handler/sapi_apache2.c: No such file or directory.
in /root/dev/php-4.4.7/sapi/apache2handler/sapi_apache2.c
(gdb) bt full
#0 php_handler (r=0x1964e8) at /root/dev/php-4.4.7/sapi/apache2handler/sapi_apache2.c:470
ctx = (php_struct *) 0x0
conf = (void *) 0x0
brigade = (apr_bucket_brigade *) 0x197f38
bucket = (apr_bucket *) 0x0
parent_req = (request_rec *) 0x0
#1 0x0002e730 in ap_run_handler ()
No symbol table info available.
#2 0x0002ed20 in ap_invoke_handler ()
No symbol table info available.
#3 0x0002baa8 in ap_process_request ()
No symbol table info available.
#4 0x0002670c in .st_double_foreff ()
No symbol table info available.
#5 0x0002670c in .st_double_foreff ()
No symbol table info available.
Previous frame identical to this frame (corrupt stack?)
(gdb) quit

I found some people with a similar problem but no answers here: http://forum.java.sun.com/thread.jspa?threadID=5137425&tstart=270

I even tried my old package for php 4.4.3 but no luck. The only difference between the old machine and the new that I know of is that the old machine is 06/06 and the new one is 11/06????

In the end, I ditch Sun’s Apache2 and install Blastwave packages and everything works.

All I can say is that Sun is wasting it’s time on desktops. Sun needs to bring their software delivery and upgrade management up to Redhat/Debian standards. If they would just do that, they could start charging for their OS again.