Duncan Coutts pushed to branch wip/io-manager-deadlock-detection at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • rts/posix/Poll.c
    ... ... @@ -424,13 +424,13 @@ void pollCompletedTimeoutsOrIOPoll(CapIOManager *iomgr)
    424 424
             int res = ppoll(poll_table, nfds, &tv, NULL);
    
    425 425
     
    
    426 426
             debugTrace(DEBUG_iomanager,
    
    427
    -                   "ppoll(nfds = %d, timeout.sec = 0, timeout.nsec = 0) = %d",
    
    427
    +                   "ppoll(nfds = %lu, timeout.sec = 0, timeout.nsec = 0) = %d",
    
    428 428
                        nfds, res);
    
    429 429
     #else
    
    430 430
             int res = poll(poll_table, nfds, 0);
    
    431 431
     
    
    432 432
             debugTrace(DEBUG_iomanager,
    
    433
    -                   "poll(nfds = %d, timeout_ms = 0) = %d",
    
    433
    +                   "poll(nfds = %lu, timeout_ms = 0) = %d",
    
    434 434
                        nfds, res);
    
    435 435
     #endif
    
    436 436
             if (res == 0) {
    
    ... ... @@ -510,15 +510,26 @@ bool awaitCompletedTimeoutsOrIOPoll(CapIOManager *iomgr)
    510 510
             int res = ppoll(poll_table, nfds, timeout_ns, NULL);
    
    511 511
     
    
    512 512
             debugTrace(DEBUG_iomanager,
    
    513
    -                   "ppoll(nfds = %d, timeout.sec = %d, timeout.nsec = %d) = %d",
    
    513
    +                   "ppoll(nfds = %lu, timeout.sec = %d, timeout.nsec = %d) = %d",
    
    514 514
                        nfds, timeout_ns == NULL ? -1 : timeout_ns->tv_sec,
    
    515 515
                              timeout_ns == NULL ?  0 : timeout_ns->tv_nsec,
    
    516 516
                        res);
    
    517
    +#elif defined(wasm32_HOST_ARCH)
    
    518
    +        /* Debug hack: on wasm CI we observe failures like
    
    519
    +         * T5866: poll res = -1: Not supported
    
    520
    +         * We want to get more detail.
    
    521
    +         */
    
    522
    +        int res = poll(poll_table, nfds, timeout_ms);
    
    523
    +        if (res < 0) {
    
    524
    +            sysErrorBelch("poll res = %d, errno = %d (ENOTSUP == %d), nfds = %lu, timeout_ms = %d",
    
    525
    +                          res, errno, ENOTSUP, nfds, timeout_ms);
    
    526
    +            stg_exit(EXIT_FAILURE);
    
    527
    +        }
    
    517 528
     #else
    
    518 529
             int res = poll(poll_table, nfds, timeout_ms);
    
    519 530
     
    
    520 531
             debugTrace(DEBUG_iomanager,
    
    521
    -                   "poll(nfds = %d, timeout_ms = %d) = %d",
    
    532
    +                   "poll(nfds = %lu, timeout_ms = %d) = %d",
    
    522 533
                        nfds, timeout_ms, res);
    
    523 534
     #endif
    
    524 535
     
    
    ... ... @@ -579,7 +590,7 @@ static void reportPollError(int res, nfds_t nfds)
    579 590
             // as soon as we get thread submitting an operation that would exceed
    
    580 591
             // the limit.
    
    581 592
         } else {
    
    582
    -        sysErrorBelch("poll res = %d", res);
    
    593
    +        sysErrorBelch("poll res = %d, errno = %d, nfds = %lu ", res, errno, nfds);
    
    583 594
             stg_exit(EXIT_FAILURE);
    
    584 595
         }
    
    585 596
     }