Bug 4894 - "java.lang.RuntimeException: not added" when removing codeObserver inside its own handler
Summary: "java.lang.RuntimeException: not added" when removing codeObserver inside its...
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
Depends on:
Blocks: 2229
  Show dependency treegraph
Reported: 2007-08-03 22:22 UTC by Petr Machata
Modified: 2007-08-06 14:44 UTC (History)
0 users

See Also:
Host: i686-pc-linux-gnu
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Petr Machata 2007-08-03 22:22:50 UTC

The exception I'm getting is the following:
java.lang.RuntimeException: not added
   at frysk.proc.live.LinuxProcState$3.handleDeleteObservation(fltrace)
   at frysk.proc.Proc$13.execute(fltrace)
   at frysk.event.EventLoop.runEventLoop(fltrace)
   at frysk.event.EventLoop.run(fltrace)
   at frysk.util.Ltrace.trace(fltrace)
   at frysk.bindir.fltrace.run(fltrace)
   at frysk.bindir.fltrace.main(fltrace)

This happens when I have the following code in updateHit:
    public Action updateHit (Task task, long addr)
      task.requestDeleteCodeObserver(this, addr);
      return Action.BLOCK;

I created a test case, will commit that.
Comment 1 Petr Machata 2007-08-03 23:34:46 UTC
The test is testCodeRemovedInHit(frysk.proc.TestTaskObserverCode).

Btw, addFailed gets called even for failed delete request.  It's a bit confusing.
Comment 2 Mark Wielaard 2007-08-06 13:18:32 UTC
Thanks for the testcase. Code observers can be added multiple times for
different addresses (as you do in this test case). But Proc doesn't know about
this and treats the double add and one delete as if the Code observer should be
deleted completely, so if you delete it for the other address the Proc sanity
check kicks in and flags it as a double delete.

Quick workaround for now is to create different Code observers for different
Comment 3 Mark Wielaard 2007-08-06 14:44:51 UTC
2007-08-06  Mark Wielaard  <mark@klomp.org>

    Fixes bug #4894
    * Proc.java (observations): Turn into a Collection that can
    contain an observer multiple times.
    * TestTaskObserverCode.java (testCodeRemovedInHit): Explicitly
    wait for add and delete.