Skip to content

[NativeAOT] Stress crash in ThreadStore::DetachCurrentThread #73116

Closed

Description

@VSadov

This is relatively rare, but it does not look linux-arm64 specific. It happens on linux-x64 as well.
(not sure about windows)

The following crash is with the current main (i.e. linux-arm64 prior to runtime suspension changes).
It may need many iterations to show up.

* thread #1, name = 'System.Net.Secu', stop reason = signal SIGSEGV
  * frame #0: 0x0000aaaaba8d1d94 System.Net.Security.Unit.Tests`unsigned long rh::std::count<SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, Thread*>(SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, Thread* const&) [inlined] SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator::_Value(this=0x0000ffff3fffe7d8) const at slist.inl:273:53
    frame #1: 0x0000aaaaba8d1d84 System.Net.Security.Unit.Tests`unsigned long rh::std::count<SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, Thread*>(SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, Thread* const&) [inlined] SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator::operator==(this=0x0000ffff3fffe7d8, rhs=0x0000ffff3fffe7c8) at slist.inl:207
    frame #2: 0x0000aaaaba8d1d74 System.Net.Security.Unit.Tests`unsigned long rh::std::count<SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, Thread*>(SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, Thread* const&) [inlined] SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator::operator!=(this=0x0000ffff3fffe7d8, rhs=0x0000ffff3fffe7c8) at slist.inl:226
    frame #3: 0x0000aaaaba8d1d74 System.Net.Security.Unit.Tests`unsigned long rh::std::count<SList<Thread, DefaultSListTraits<Thread, DoNothingFailFastPolicy> >::Iterator, Thread*>(_First=Iterator @ 0x0000ffff3fffe7d8, _Last=Iterator @ 0x0000ffff3fffe7c8, _Val=0x0000ffff3fffe7b8) at type_traits.hpp:232
    frame #4: 0x0000aaaaba8d1514 System.Net.Security.Unit.Tests`ThreadStore::DetachCurrentThread() at threadstore.cpp:170:9

Activity

  1. self-assigned this
    on Jul 30, 2022
  2. ghost added
    untriaged
    on Jul 30, 2022
  3. MichalStrehovsky commented on Aug 3, 2022

    @MichalStrehovsky
    Member

    @VSadov could you milestone this and remove untriaged? It shows up in queries.

  4. removed
    untriaged
    on Aug 3, 2022
  5. added this to the 7.0.0 milestone on Aug 3, 2022
  6. VSadov commented on Aug 13, 2022

    @VSadov
    MemberAuthor

    I do not see this any more. It could be related to the changes I was testing.

  7. VSadov commented on Aug 14, 2022

    @VSadov
    MemberAuthor

    Saw this again. Several times in one run.

  8. reopened this on Aug 14, 2022
  9. VSadov commented on Aug 14, 2022

    @VSadov
    MemberAuthor

    I think I know what is going on. At shutdown we allow some threads to terminate without removing themselves from thread list. Once a TLS of such thread is released, the thread list becomes corrupted, so whoever iterates it crashes.

    Should be a simple fix.

  10. ghost added
    in-pr
    on Aug 14, 2022
  11. ghost removed
    in-pr
    on Aug 14, 2022
  12. ghost locked as resolved and limited conversation to collaborators on Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions