#3320: Parallel program crashes using GHC 6.11 under OS X
-------------------------------+--------------------------------------------
    Reporter:  sebf            |        Owner:  simonmar
        Type:  bug             |       Status:  new     
    Priority:  high            |    Milestone:  6.12.1  
   Component:  Runtime System  |      Version:  6.11    
    Severity:  normal          |   Resolution:          
    Keywords:                  |   Difficulty:  Unknown 
    Testcase:                  |           Os:  MacOS X 
Architecture:  x86             |  
-------------------------------+--------------------------------------------
Comment (by igloo):

 Here's the end of a run with a slightly instrumented RTS:
 {{{
 RELEASE_LOCK(0x801330) rts/Capability.c 644
 Calling yieldCapability 2 with 0x801280
 Called yieldCapability with 0x801280
 RELEASE_LOCK(0x7009f8) rts/Capability.c 618
 ACQUIRE_LOCK(0x8011f0) rts/Capability.c 622
 RELEASE_LOCK(0x8011f0) rts/Capability.c 626
 ACQUIRE_LOCK(0x7009f8) rts/Capability.c 613
 RELEASE_LOCK(0x801330) rts/Capability.c 842
 Calling yieldCapability 1 with 0x801140
 Called yieldCapability with 0x801140
 ACQUIRE_LOCK(0x2ca7e0) rts/Schedule.c 906
 RELEASE_LOCK(0x2ca7e0) rts/Schedule.c 916
 Garbage collecting
 ACQUIRE_LOCK(0x2cb8a0) rts/sm/GC.c 199
 ACQUIRE_LOCK(0x2ca2a0) rts/Stable.c 325
 RELEASE_LOCK(0x2cb8a0) rts/sm/GC.c 755
 ACQUIRE_LOCK(0x2cb8a0) rts/sm/GC.c 757
 RELEASE_LOCK(0x2cb8a0) rts/sm/GC.c 760
 ACQUIRE_LOCK(0x2cb8a0) rts/sm/GC.c 763
 RELEASE_LOCK(0x2ca2a0) rts/Stable.c 331
 RELEASE_LOCK(0x2cb8a0) rts/sm/GC.c 812
 Finished garbage collecting
 ACQUIRE_LOCK(0x8011f0) rts/Capability.c 534
 RELEASE_LOCK(0x8011f0) rts/Capability.c 545
 Calling yieldCapability 2 with 0x801140
 ACQUIRE_LOCK(0x700ac8) rts/Capability.c 548
 Calling yieldCapability 2 with 0x801280
 Called yieldCapability with 0x801140
 Called yieldCapability with 0xb0103000
 Calling releaseCapabilityAndQueueWorker with 0x801140
 Calling releaseCapabilityAndQueueWorker with 0xb0103000
 ACQUIRE_LOCK(0x8011f0) rts/Capability.c 457
 ACQUIRE_LOCK(0xb01030b0) rts/Capability.c 457
 ACQUIRE_LOCK(0x700ac8) rts/Capability.c 350
 Task is NULL! 0xb0103000 0xb01030b0
 RELEASE_LOCK(0x700ac8) rts/Capability.c 356
 RELEASE_LOCK(0x8011f0) rts/Capability.c 481
 RELEASE_LOCK(0x700ac8) rts/Capability.c 553
 ACQUIRE_LOCK(0x700be8) rts/Capability.c 613
 ACQUIRE_LOCK(0x8011f0) rts/Capability.c 556
 RELEASE_LOCK(0x8011f0) rts/Capability.c 566
 Bus error
 }}}
 The
 {{{
 Garbage collecting
 [...]
 Finished garbage collecting
 }}}
 are the start and end of `rts/sm/GC.c:GarbageCollect`, so it looks to me
 like we aren't supposed to be GCing when things go wrong.

 In particular, see these two lines:
 {{{
 Calling yieldCapability 2 with 0x801280
 [...]
 Called yieldCapability with 0xb0103000
 }}}
 These are:
 {{{
     if (prev_pending_gc) {
         do {
             debugTrace(DEBUG_sched, "someone else is trying to GC
 (%d)...",
                        prev_pending_gc);
             ASSERT(cap);
             printf("Calling yieldCapability 2 with %p\n", cap);
             yieldCapability(&cap,task);
         } while (waiting_for_gc);
         return cap;  // NOTE: task->cap might have changed here
     }
 }}}
 and
 {{{
 void
 yieldCapability (Capability** pCap, Task *task)
 {
     Capability *cap = *pCap;
     printf("Called yieldCapability with %p\n", cap);
 }}}

 The
 {{{
 Task is NULL! 0xb0103000 0xb01030b0
 }}}
 is the point where the bus error actually happens:
 {{{
 static void
 releaseCapabilityAndQueueWorker (Capability* cap USED_IF_THREADS)
 {
     Task *task;

     ACQUIRE_LOCK(&cap->lock);

     task = cap->running_task;

     if (task == NULL) {
         printf("Task is NULL! %p %p\n", cap, &cap->lock);
         fflush(stdout);
     }

     [...]

     if (!isBoundTask(task) && !task->stopped && !task->suspended_tso) {
 }}}
 which looks like a symptom of the corrupt cap.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3320#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to