Bug 2628

Summary: Unhandeled state {frysk.proc.LinuxTask@4f64be0,pid=3048,tid=3048,state=detached} in state "detached" did not handle handleUnblock
Product: frysk Reporter: Sami Wagiaalla <swagiaal>
Component: generalAssignee: Andrew Cagney <cagney>
Status: RESOLVED FIXED    
Severity: normal CC: scox
Priority: P1    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 1516    

Description Sami Wagiaalla 2006-05-01 16:55:51 UTC
Select a proc, add a FrokObserver, induce a fork
and boom:

Frysk Core has reported the following errors

{frysk.proc.LinuxTask@4f64be0,pid=3048,tid=3048,state=detached} in state
"detached" did not handle handleUnblock

frysk.proc.State.unhandled (FryskGui)
frysk.proc.TaskState.handleUnblock (FryskGui)
frysk.proc.Task$2.execute (FryskGui)
frysk.event.EventLoop.runEventLoop (FryskGui)
frysk.event.EventLoop.run (FryskGui)
frysk.gui.Gui$3.run (FryskGui)
java.lang.Thread.run (libgcj.so.7)
Comment 1 Stan Cox 2006-05-19 20:39:31 UTC
*** Bug 2650 has been marked as a duplicate of this bug. ***
Comment 2 Stan Cox 2006-05-22 23:00:49 UTC
I set a fork observer on bash then execute:
 find /home /lib /lib64 /bin /usr/bin /etc  -name 'x*'
frysk.gui.monitor.observers.TaskForkedObserver.bottomHalf calls
frysk.proc.Task.requestUnblock for:
 proc state=Detaching 
 task state=StartMainTask.wantToDetach


StartMainTask.handleStoppedEvent 
->calls blockOrDetach 
  ->calls sendDetach
  ->calls performTaskDetachCompleted
eventLoop.add 
->calls handleUnblock

22-May-06 6:04:12 PM frysk.proc.TaskState$StartMainTask$5 handleStoppedEvent
{frysk.proc.LinuxTask@329e3395,pid=6682,tid=6682,state=StartMainTask.wantToDetach}
handleStoppedEvent

22-May-06 6:04:12 PM frysk.proc.LinuxTask sendDetach
{frysk.proc.LinuxTask@329e3395,pid=6682,tid=6682,state=StartMainTask.wantToDetach}
sendDetach

22-May-06 6:04:12 PM frysk.proc.Proc performTaskDetachCompleted
{frysk.proc.LinuxProc@31cac2d5,pid=6682,command=bash,state=Detaching}
performTaskDetachCompleted

22-May-06 6:04:12 PM frysk.proc.TaskState$10 handleUnblock
{frysk.proc.LinuxTask@31c4e42d,pid=3387,tid=3387,state=running} handleUnblock

22-May-06 6:04:12 PM frysk.proc.TaskState$1 handleUnblock
{frysk.proc.LinuxTask@329e3395,pid=6682,tid=6682,state=detached} handleUnblock

Comment 3 Andrew Cagney 2006-05-30 06:43:11 UTC
I think this might have been a GUI bug, fixed with:

2006-05-30  Andrew Cagney  <cagney@redhat.com>

        * TaskObserver.java (Forked): Add method updateForkedOffspring.
        (Cloned): Add method updateClonedOffspring.
        * TestTaskObserverBlocked.java: Handle updateForkedOffspring, and
        updateClonedOffspring.
        * TestTaskObserverDetach.java: Ditto.
        * TestTaskForkedObserver.java: Handle updateForkedOffspring.
        * TestTaskClonedObserver.java: Handle updateClonedOffspring.
        * TaskState.java: Generate notifyForkedOffspring, and
        notifyClonedOffspring events.
        * Task.java (id, proc): Make final.
        (creator): New member.
        (Task): Initialize creator.
        (notifyClonedOffspring, notifyForkedOffspring): New.
        * ProcState.java ("detached" .handleAddTasksObserver): Add
        updateClonedOffspring to local class, block the offspring.

Note the last change, where it blocks the offspring (before it could run free
resulting in an attempt to unblock an unattached task).

This lead to the related change:

2006-05-30  Andrew Cagney  <cagney@redhat.com>

        * observers/TaskForkedObserver.java: Handle updateForkedOffspring.
        Always block both the parent and offspring (the bottomHalf always
        unblocks).
        * observers/TaskCloneObserver.java: Handle updateClonedOffspring.
        * EventLogger.java: Handle updateForkedOffspring, and
        updateClonedOffspring.

in particular the updateForked* observers now always block (before the block was
conditional on something).  The lack of blocking could result in race conditions.