swiftlang / swiftlang/swift-corelibs-libdispatch

[SR-13841] Perf Incorrectly Assigns Dispatch Calls

Open
#608 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug libdispatch
Dominant language
C
Stars
2.6k
Forks
496
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Previous ID SR-13841
Radar rdar://problem/71271956
Original Reporter xanderai (JIRA User)
Type Bug

Attachment: Download

Environment

This was run on Ubuntu 18.04 with Swift for Tensorflow 0.10:

```

$ swift --version
Swift version 5.3-dev (LLVM 55d27a5828, Swift 6a5d84ec08)
Target: x86_64-unknown-linux-gnu
$ which swift
/home/xander/swift-tensorflow-RELEASE-0.10-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift

```

I don't believe it's specific to Swift for Tensorflow.

Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Bug
Assignee None
Priority Medium

md5: 5c2364057133aadaf7ecfa69ab055195

Issue Description:

This is based on the Swift Forums discussion here.

Find attached a screenshot of a perf flamegraph that was captured on 8 hours of a Swift server that uses Swift NIO and serial async DispatchQueues. Notice that everything above the `_dispatch_call_block_and_release` is occurring on the serial DispatchQueues. We think those call stacks are not actually executing on NIO's threads, but have been incorrectly assigned to them by perf. It seems like dispatch is missing some debug symbols, which prevents perf getting an accurate handle on how we get into `_dispatch_call_block_and_release`.

This flame graph was collected using the instructions here.

![](Screen Shot 2020-11-08 at 22.30.34.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached perf flamegraph, the linked Penguin perf guide, and the Swift Forums discussion for context. Investigate libdispatch's debug-symbol handling around _dispatch_call_block_and_release on the stated Ubuntu and Swift for TensorFlow environment; done means explaining the incorrect thread attribution and identifying a concrete fix or reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.