[Oberon] AosModules.FreeModule issue (possible bug)

Mircea Alexandru Popescu Moscu mircalex at yahoo.com
Tue Jun 6 09:26:11 CEST 2006

Hi there,

Here's some kind of bug (or something) that seems to
be related to a design flaw in AosModules.FreeModule

1. How to produce it:
Open a PET window
Run twice, in a split second the following line (the
key is that the second run is almost simultaneous to
the first one). You can just do a double click and
that's garanted to give you the trap that follows.
S.Free PET ~

Unloading PETPET terminated done.
[1] TRAP 46136860 PL 3 46136860  HALT statement
WinAos 2.03 050530
 CS:=0000001B DS:=00000023 ES:=00000023 SS:=00000023
EIP=01208078 ESI=038A84A0 EDI=038C39FC ESP=02BFFE10
 EAX=00000000 EBX=00000005 ECX=02BFFDC0 EDX=7FFE0304
EBP=02BFFE10 FS:=00000038 GS:=00000000 TMR=001FF5F2
 EFLAGS: cPaZstIdo iopl0 {1..2, 6, 9}
Process: 3428 run3428 2
01B0BC70:WMMessages.MsgSequencer Unknown PC=7FFE0304H
{0, 28}
PET?.DecCount PC=35392
State PET?:
  @Self=00D88410H  nofWindows=0  res=0 
scratchText=00000000H  scratchModified=FALSE
PET?.Window.Close PC=33036
  @Self=0101A850H  page=100
PET?.Window.Handle PC=33125
  x=Rec.0000028CH  @Self=0101A850H  data=00000000H 
elem=00000000H  a=00000000H
  n=""  str=""  filename=""...  i=0
WMMessages.MsgSequencer.Handle PC=1360
  msg=Rec.00000004H  @Self=01B0BC70H
WMMessages.MsgSequencer. at Body PC=2102
AosActive.Wrapper PC=3869
  lpParameter=01B1BD30H  t=01B1BD30H  obj=01B0BC70H 
type=17005992 (01037DA8H)
  res=1  excpfrm=Rec.0000007CH
Unknown PC=77E7D33BH FP=02BFFFECH
Unloading PETPET not found 

2. Guess on what happens:
a) the first run (thread) enters in
AosModules.FreeModule calls the termination handler
and waits for the terminationhandler to finish.
b) the second run enters in AosModules.FreeModule,
passes over the section where the termination handler
is called (the first run has set the m.term pointer to
NILL before calling the handler) and enters the
critical section proceeding forward and freeing the
module PET
c) the first run is still inside the termination
handler and upon spotting the PET module was freed the
system traps.

3. I guess that ther must be some kind of lock for the
section where the termination handler is called, maybe
not guarded with AosLocks.Acquire(AosLocks.AosModules)
but with some other "private" lock

All the best,
Alex Popescu

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the Oberon mailing list