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-9885] Leaks in Casting Machinery on Linux in test/Interpreter/generic_casts.swift #52291

Open
gottesmm opened this issue Feb 7, 2019 · 4 comments

Comments

@gottesmm
Copy link
Member

@gottesmm gottesmm commented Feb 7, 2019

Previous ID SR-9885
Radar None
Original Reporter @gottesmm
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Runtime
Assignee @mikeash
Priority Medium

md5: 93ea328d101025f6cca0a0865c4df0b4

Issue Description:

I discovered this while running swift with asan on Linux (which also checks for leaks). You should be able to just compile generic_casts.swift with -sanitize=address to reproduce.

******************** TEST 'Swift(linux-x86_64) :: Interpreter/generic_casts.swift' FAILED ********************
Script:
--
: 'RUN: at line 1';   rm -rf "/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp" && mkdir -p "/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp" && /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin/swiftc -target x86_64-unknown-linux-gnu  -module-cache-path '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 4   -module-cache-path '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift -o /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out -module-name main -sanitize=address -g && echo /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out && /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out | '/usr/bin/python' '/Users/docker_user/src/swift/utils/PathSanitizingFileCheck' --sanitize BUILD_DIR='/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64' --sanitize SOURCE_DIR='/Users/docker_user/src/swift' --use-filecheck '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/bin/FileCheck' /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift
: 'RUN: at line 2';   /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/bin/swiftc -target x86_64-unknown-linux-gnu  -module-cache-path '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/swift-test-results/x86_64-unknown-linux-gnu/clang-module-cache' -swift-version 4   -O /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift -o /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out.optimized
: 'RUN: at line 3';   echo /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out.optimized
: 'RUN: at line 4';    /Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out.optimized | '/usr/bin/python' '/Users/docker_user/src/swift/utils/PathSanitizingFileCheck' --sanitize BUILD_DIR='/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64' --sanitize SOURCE_DIR='/Users/docker_user/src/swift' --use-filecheck '/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/llvm-linux-x86_64/bin/FileCheck' /Users/docker_user/src/swift/test/Interpreter/generic_casts.swift
--
Exit Code: 2

Command Output (stdout):
--
/Users/docker_user/src/build/Ninja-RelWithDebInfoAssert/swift-linux-x86_64/test-linux-x86_64/Interpreter/Output/generic_casts.swift.tmp/a.out

--
Command Output (stderr):
--
LLVMSymbolizer: error reading file: No such file or directory

=================================================================
==128919==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 2 object(s) allocated from:
    #​0 0x5565a3d7e093 in malloc /Users/docker_user/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
    #​1 0x7fdb8076b381 in swift_slowAlloc /Users/docker_user/src/swift/stdlib/public/runtime/Heap.cpp:80:9
    #&#8203;2 0x7fdb80766040 in _dynamicCastToExistential(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetExistentialTypeMetadata<swift::InProcess> const*, swift::DynamicCastFlags)::$_9::operator()() const /Users/docker_user/src/swift/stdlib/public/runtime/Casting.cpp:785:19
    #&#8203;3 0x7fdb80766040 in _dynamicCastToExistential(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetExistentialTypeMetadata<swift::InProcess> const*, swift::DynamicCastFlags) /Users/docker_user/src/swift/stdlib/public/runtime/Casting.cpp:854
    #&#8203;4 0x7fff50c53f7f  ([stack]+0x1ef7f)
@gottesmm
Copy link
Member Author

@gottesmm gottesmm commented Feb 7, 2019

Keep in mind I am not sure if this is Linux specific.

@gottesmm
Copy link
Member Author

@gottesmm gottesmm commented Feb 7, 2019

I just tried the Feb 4th swift-4.2.2 toolchain. We leak on this code as well there.

@gottesmm
Copy link
Member Author

@gottesmm gottesmm commented Feb 7, 2019

I just tried on master with leaks -atExit – to see if we leak there. It seems to think we aren't leaking.

@gottesmm
Copy link
Member Author

@gottesmm gottesmm commented Feb 7, 2019

So this seems to be a linux specific problem.

@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
Projects
None yet
Development

No branches or pull requests

1 participant