NullPointerException in waitCond()

Archie Cobbs archie at whistle.com
Thu Jul 30 13:10:20 PDT 1998


My application is failing because of a NullPointerException, and a little
debugging show that getLock() is returning NULL in the function waitCond()
in "kaffe/kaffevm/locks.c":

  /*
   * Wait on a conditional variable.
   */
  int
  _waitCond(void* addr, jlong timeout)
  {
	  iLock* lk;
	  int count;

  DBG(VMLOCKS,    dprintf("Wait 0x%x on addr=0x%x\n", THREAD_NATIVE(), addr);  )

  #if defined(USE_LOCK_CACHE)
	  lk = ((Hjava_lang_Object*)addr)->lock;
  #else
	  lk = getLock(addr);
  printf("Wait 0x%x lk=0x%x from getLock()\n", THREAD_NATIVE(), lk);
  #endif

	  __waitCond(lk, timeout);
	  return (0);
  }

When I run the program (which uses threads), I get this output:

Wait 0x634038 lk=0x0 from getLock()
java.lang.NullPointerException
        at java/lang/Object.wait(46)
        at java/lang/Object.wait(42)
	...

The NULL return from getLock() is causing the problem (because
the first thing __waitCond() does is dereference it).

This happens completely deterministically, as far as I can tell.
This is kaffe vintage july 29 snapshot (yesterday).
How can I help debug this problem? 

On another note, sometimes Kaffe will not respond to Control-C (SIGINT).
In fact, it often only stops with kill -9 when running a certain application.
What's the theory on how SIGINT is handled?

Thanks,
-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list