Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-7583] simple TSan test program just crashes with latest master dev snapshot #50125

Open
weissi opened this issue May 2, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself Linux Platform: Linux

Comments

@weissi
Copy link
Member

weissi commented May 2, 2018

Previous ID SR-7583
Radar None
Original Reporter @weissi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Linux
Assignee None
Priority Medium

md5: ad1d36cf8bac1dcbc29eceb22776f5ac

Issue Description:

this simple program (which should run TSan clean but doesn't on 4.1 (SR-7582)) now just crashes on the latest swift master dev snapshot:

import Dispatch

var a: Int = 0
let q = DispatchQueue(label: "q")
q.async {
    a += 1
}

let aViaThread = q.sync { () -> Int in
    a += 1
    return a
}

print(aViaThread)

see here what happens when compiled (with TSan, works fine without) & run:

$ /usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a-ubuntu16.04/usr/bin/swiftc -sanitize=thread test.swift 
jweiss:/tmp
$ ./test 
Segmentation fault (core dumped)
-SEGV- jweiss:/tmp
$ /usr/local/swift/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a-ubuntu16.04/usr/bin/lldb ./test
(lldb) target create "./test"
Current executable set to './test' (x86_64).
(lldb) run
Process 32445 launched: './test' (x86_64)
Process 32445 stopped
* thread #​1, name = 'test', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #​0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (test) stopped.
(lldb) bt
* thread #​1, name = 'test', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #​0: 0x0000000000000000
    frame #​1: 0x00005555555d6bab test`::MonotonicNanoTime() at sanitizer_linux_libcdep.cc:754
    frame #​2: 0x00005555555b0648 test`::PopulateFreeArray() at sanitizer_allocator_primary64.h:700
    frame #​3: 0x00005555555b0235 test`::GetFromAllocator() at sanitizer_allocator_primary64.h:136
    frame #​4: 0x00005555555afe99 test`::Refill() at sanitizer_allocator_local_cache.h:111
    frame #​5: 0x00005555555afb47 test`::Allocate() at sanitizer_allocator_local_cache.h:47
    frame #​6: 0x00005555555ad4a3 test`::Allocate() at sanitizer_allocator_combined.h:62
    frame #​7: 0x00005555555ac627 test`::user_alloc_internal() at tsan_mman.cc:157
    frame #​8: 0x00005555555acb17 test`::user_calloc() at tsan_mman.cc:183
    frame #​9: 0x000055555556018c test`::__interceptor_calloc() at tsan_interceptors.cc:684
    frame #​10: 0x00007ffff6f29627
(lldb) 
@belkadan
Copy link
Contributor

belkadan commented May 2, 2018

cc @kubamracek

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself Linux Platform: Linux
Projects
None yet
Development

No branches or pull requests

2 participants