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-3103] TestProcessAttach.py FAILED #4509

Open
shahmishal opened this issue Nov 1, 2016 · 5 comments
Open

[SR-3103] TestProcessAttach.py FAILED #4509

shahmishal opened this issue Nov 1, 2016 · 5 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@shahmishal
Copy link
Member

Previous ID SR-3103
Radar None
Original Reporter @shahmishal
Type Bug
Status In Progress
Resolution

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

Watchers: @shahmishal

md5: 1c066f41a39c7313273e32d8db00a399

Issue Description:

[TestProcessAttach.py FAILED]
Command invoked: /usr/bin/python /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/test/dotest.py --executable /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/lldb-linux-x86_64/bin/lldb --rerun-all-issues -C /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/llvm-linux-x86_64/bin/clang -s 2016-11-01-05_06_55 --results-port 42484 --inferior -p TestProcessAttach.py /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test --event-add-entries worker_index=0:int
https://ci.swift.org/job/oss-swift-3.0-package-linux-ubuntu-15_10/142/

2 out of 2 test suites processed - TestProcessAttach.py
Test rerun complete

@trfiala
Copy link
Mannequin

trfiala mannequin commented Nov 1, 2016

Strange, the failure was because there were two processes with the given name running, so the attach didn't know which one to use:

```
os command: make clean
with pid: 30718
stdout: rm -f main.o main.d main.d.tmp main.dwo
rm -f "ProcessAttach"

stderr:
retcode: 0

os command: make MAKE_DSYM=NO ARCH=x86_64 CC=/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/llvm-linux-x86_64/bin/clang SWIFTCC=/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/swift-linux-x86_64/bin/swiftc
with pid: 30742
stdout: /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/llvm-linux-x86_64/bin/clang++ -std=c++11 -g -O0 -fno-builtin -m64 -I/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test/make/../../../../../include -include /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test/make/test_common.h -c -o main.o main.cpp
/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/llvm-linux-x86_64/bin/clang++ main.o -g -O0 -fno-builtin -m64 -I/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test/make/../../../../../include -include /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test/make/test_common.h -o "ProcessAttach"

stderr:
retcode: 0

Adding tearDown hook: def cleanupSubprocesses(self):

  1. Ensure any subprocesses are cleaned up
    for p in self.subprocesses:
    p.terminate()
    del p
    del self.subprocesses[:]

  2. Ensure any forked processes are cleaned up
    for pid in self.forkedProcessPids:
    if os.path.exists("/proc/" + str(pid)):
    os.kill(pid, signal.SIGTERM)

runCmd: process attach -n ProcessAttach
runCmd failed!
error: attach failed: more than one process named ProcessAttach:
PID PARENT USER TRIPLE ARGUMENTS
====== ====== ========== ======================== ============================
30705 28351 buildnode x86_64-*-linux
30900 28511 buildnode x86_64-*-linux

FAIL

<bound method SBProcess.Kill of <lldb.SBProcess; proxy of <Swig Object of type 'lldb::SBProcess *' at 0x7fc4d2c9a2a0> >>: success

Executing tearDown hook: def cleanupSubprocesses(self):

  1. Ensure any subprocesses are cleaned up
    for p in self.subprocesses:
    p.terminate()
    del p
    del self.subprocesses[:]

  2. Ensure any forked processes are cleaned up
    for pid in self.forkedProcessPids:
    if os.path.exists("/proc/" + str(pid)):
    os.kill(pid, signal.SIGTERM)

Traceback (most recent call last):
File "/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1483, in dwarf_test_method
return attrvalue(self)
File "/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py", line 47, in test_attach_to_process_by_name
self.runCmd("process attach -n " + exe_name)
File "/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1812, in runCmd
msg if msg else CMD_MSG(cmd))
AssertionError: False is not True : Command 'process attach -n ProcessAttach' returns successfully
Config=x86_64-/home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/llvm-linux-x86_64/bin/clang-3.9
Session info generated @ Tue Nov 1 05:16:58 2016
To rerun this test, issue the following command from the 'test' directory:

./dotest.py -A x86_64 -C /home/buildnode/jenkins/workspace/oss-swift-3.0-package-linux-ubuntu-15_10/build/buildbot_linux/llvm-linux-x86_64/bin/clang-3.9 -v -t -f ProcessAttachTestCase.test_attach_to_process_by_name_dwarf
```

@trfiala
Copy link
Mannequin

trfiala mannequin commented Nov 1, 2016

I also just attached the full set of logs from the builder before it gets blown away. (We need to adjust the CI to save the test results as artifacts...)

@trfiala
Copy link
Mannequin

trfiala mannequin commented Nov 1, 2016

My best guess here is the following:

1. The test is not marked as no-debug-info, so it runs 2+ times (serially), once for dwarf, once for dwo, anything else Linux uses.
2. The previous test has finished, but the ProcessAttach process has not yet entirely gone away, at least as far as 'ps' and the proc table are concerned.
3. Our attach in the second+ run see the ProcessAttach test inferior still alive, and fails to be able to attach by name.

There are two ways to solve this:

  1. This shouldn't be a debug-info-specific test, so stop it from being debug-info specific. This should address the "test inferior process is still visible" element, preventing this particular case hit here. It does nothing to stop two test suite runs (say, for different build jobs) that both happen to run this test at the same time, and therefore have the same-named executable.

2. Figure out how to attach by name (as the test is trying to do), but with a name guaranteed to be unique. This could be ProcessAttach-{guid} or something. Then two test runs at the same time on different build jobs would not collide.

Since approach #1 is appropriate and likely will address this, I'll start with that.

@trfiala
Copy link
Mannequin

trfiala mannequin commented Nov 1, 2016

I put in a fix in LLVM.org LLDB svn trunk (r285726):
```
commit 534469037734db8444ea3f7d7158430c55c94cbb (HEAD -> master, origin/master, origin/HEAD)
Author: Todd Fiala <todd.fiala@gmail.com>
Date: Tue Nov 1 11:50:34 2016

change ProcessAttach test to no-debug-info

Fixes:
https://bugs.swift.org/browse/SR-3103

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@285726 91177308-0d34-0410-b5e6-96231b3b80d8
```

@trfiala
Copy link
Mannequin

trfiala mannequin commented Dec 28, 2016

Pulling myself off of this - no longer with Apple.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

1 participant