Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,249
    • Issues 5,249
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 573
    • Merge requests 573
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #20464
Closed
Open
Issue created Oct 03, 2021 by Ben Gamari@bgamari🐢Maintainer

TSAN failures in exitTicker

Currently the non-threaded RTS produces spurious ThreadSanitizer failures of the form:

WARNING: ThreadSanitizer: data race (pid=118233)
  Write of size 1 at 0x7f66710635f0 by main thread:
    #0 exitTicker rts/posix/ticker/Pthread.c:246 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000007ffc8)
    #1 exitTimer rts/Timer.c:209 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000005b4f7)
    #2 hs_exit_ rts/RtsStartup.c:478 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000004ccb0)
    #3 shutdownHaskellAndExit rts/RtsStartup.c:640 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000004d375)
    #4 hs_main rts/RtsMain.c:99 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000004c259)
    #5 main <null> (ghc-pkg-9.3.20211002+0x00000047a574)
  Previous read of size 1 at 0x7f66710635f0 by thread T1:
    #0 itimer_thread_func rts/posix/ticker/Pthread.c:128 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000007fb83)
    #1 <null> <null> (libtsan.so.0+0x000000024459)
  Location is global 'exited' of size 1 at 0x7f66710635f0 (libHSrts-1.0.2-ghc9.3.20211002.so+0x0000000b35f0)
  Thread T1 'ghc_ticker' (tid=118235, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x000000027e9d)
    #1 initTicker rts/posix/ticker/Pthread.c:202 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000007fe1b)
    #2 initTimer rts/Timer.c:180 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000005b0fa)
    #3 hs_init_ghc rts/RtsStartup.c:295 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000004cf98)
    #4 hs_main rts/RtsMain.c:57 (libHSrts-1.0.2-ghc9.3.20211002.so+0x00000004c1eb)
    #5 main <null> (ghc-pkg-9.3.20211002+0x00000047a574)
SUMMARY: ThreadSanitizer: data race rts/posix/ticker/Pthread.c:246 in exitTicker

This is because the non-threaded RTS compiles out all of the barrier and atomic operations defined in rts/include/stg/SMP.h. Given that the non-threaded RTS is now no longer single-threaded (as it may use the pthread ticker implementation) we should probably compile at least some of these as their threaded implementations.

Edited Oct 05, 2021 by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking