Kaffe & JServ

Dan Morrill morrill at crd.ge.com
Thu Oct 15 07:02:10 PDT 1998


Tim Wilkinson wrote:

> Can you provide more information?

Well, you asked for it...  ;)


> Does Kaffe startup at all for example, and when does it die?  Does it
> dump core, exit or raise an exception.

Attached is a file "errors" containing the output from running the
thing with -verbosejit.

You didn't say whether you're familiar with Apache and JServ, so I'll
give an overview of how this is being run.  The idea is that JServ is
a plugin for Apache that provides a server-side include module for
the <SERVLET> tag in HTML documents.  When JServ encounters such a
tag (which refers to a Java class to be executed), it connects to a
JVM listening on a port specified in a config file and requests that
the appropriate Servlet be invoked.  The output from this invocation
is forwarded back through JServ to the client.  The JServ module
doesn't care what JVM it's talking to, so all you do is specify the
path to a JVM binary (in this case Kaffe) that you want to use.

Once the JVM is up, it's supposed to listen on stdin, waiting for
a request to come from Apache.  I would assume this means that
stdin is reassigned to whatever port the JVM is supposed to be
listening on.  The stderr of the JVM is supposed to be
redirected to a log file.

Of course, the above is merely is my understanding of the process; I
may be wrong.


I am not starting the JVM myself;  it's started automatically by JServ
when Apache starts up.  I have a few shell scripts that I use to start,
stop, and restart Apache, which automatically restarts the JVM.
Basically all they look like is:

#!/bin/sh
/clients/apache/sbin/httpd -f /clients/apache/apache-jserv-kaffe/etc/httpd.conf

When I run this shell script with the Sun JDK, it starts up normally
and everyone seems happy.  (Apache, JServ, and me. :)  When I start this
up with Kaffe, I get weird behavior at the prompt:  it's like someone is
holding down the "RETURN" key (i.e. the prompt is redisplayed), but the
terminal doesn't actually print a carriage return:

root at hobbestmp> ./apache-onroot at hobbestmp> root at hobbestmp> root at hobbestmp> 
root at hobbestmp> root at hobbestmp> root at hobbestmp> root at hobbestmp>

...ad infinitum, until the JVM dies.  (When Kaffe finally dies, the behavior
stops.)  If I specify -verbosejit, the output from that is mixed in with the
prompt spam.  If I do `./apache-on >& errors`, the terminal comes back without
the prompt weirdness, and the -verbosejit information is correctly printed
to `errors`.

Judging by the attached `errors` file, it looks like Kaffe is starting up,
creating its threads, etc. and then simply shutting itself down, as though a
polling loop (or thread?) somewhere is not being executed.  Also, I mentioned
above that stderr is redirected to a log file. This log file is empty
throughout this whole process, so apparently no errors are occuring.


<SPECULATION>
I'm guessing that what's going on is that Kaffe is not redirecting stdin to
the socket:  it's still trying to use stdin, hence the infinite prompt loop
business.  Kaffe will continue to run until I kill that shell, at which point
it says, "Oh my, got a read error on stdin.  Must exit." and then exits
normally.

This is corroborated by the fact that when the prompt is in its loop, if you
telnet to the port the JVM is supposed to be listening on, you get
"connection refused" but the JVM is still in the process list.

Note:  I have looked at no code, and this is just my gut feeling.
</SPECULATION>


As you can see, this is kind of a messy problem.  There may be a way I can
start Kaffe by hand and see what I can see, and I can also look at
java.apache.org (the JServ home page) to see if there's any more explicit
information on what JServ actually expects the JVM to do.  No guarantees
though, and the time I have to spend on this is unfortunately limited as
I am under something of a deadline.


Dan Morrill
Computer Scientist
GE Corporate R&D
******************
My views are my own, and may not reflect those of my employer.


More information about the kaffe mailing list