Skip to content

[SR-6555] Regression: Reusing an URLSession on Swift 4.x causes constant CPU time #4044

Open
@swift-ci

Description

@swift-ci
Previous ID SR-6555
Radar None
Original Reporter graemer957 (JIRA User)
Type Bug

Attachment: Download

Environment

Swift version 4.0 (swift-4.0-RELEASE)

Swift version 4.0.2 (swift-4.0.2-RELEASE)

Swift version 4.0.3 (swift-4.0.3-RELEASE)

Swift version 4.1 (swift-4.1-RELEASE)

Swift version 4.1.1 (swift-4.1.1-RELEASE)

Swift version 4.1.2 (swift-4.1.2-RELEASE)

Swift version 4.2-dev (LLVM 70f121e1f0, Clang 4c555650a6, Swift bb9532c588)

Additional Detail from JIRA
Votes 1
Component/s Foundation
Labels Bug
Assignee @pushkarnk
Priority Medium

md5: 0ccd93cd881b11aece0f0343f75c7fb7

Issue Description:

Steps to reproduce

Using the attached project with Swift 4.0.3 under Ubuntu 14.04.5 LTS:

  1. Leave top running in one session
  2. In a new session swift build
  3. swift run
  4. Observe after first HTTP response CPU time drops back to zero
  5. However, after second HTTP response CPU is using constant time

Expected behaviour

CPU time is not constantly used.

Workaround

Recreate URLSession for each dataTask(with: ), by commenting out line 4 and uncommenting line 7.

Swift versions affected

  • Swift version 4.0 (swift-4.0-RELEASE)

  • Swift version 4.0.2 (swift-4.0.2-RELEASE)

  • Swift version 4.0.3 (swift-4.0.3-RELEASE)

  • Swift version 4.1 (swift-4.1-RELEASE)

  • Swift version 4.1.1 (swift-4.1.1-RELEASE)

  • Swift version 4.1.2 (swift-4.1.2-RELEASE)

  • Swift version 4.2-dev (LLVM 70f121e1f0, Clang 4c555650a6, Swift bb9532c588)

Swift versions unaffected

  • Swift version 3.1.1 (swift-3.1.1-RELEASE)

Misc

  • Target is x86_64-unknown-linux-gnu

  • Have tried Ubuntu 16.04, but it exhibits the same behaviour

  • If the attachment is unavailable, it can be found on GitLab

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions