Skip to content

[Android][Linux] Fixed hang when using RunLoop.main.run with Date() #2544

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

Merged
merged 2 commits into from
Nov 19, 2019

Conversation

Molanda
Copy link
Contributor

@Molanda Molanda commented Oct 17, 2019

When using RunLoop.main.run(mode: .default, before: Date()) on Android, the call would not return.

This function, along with limitDate (which also would hang), calls CFRunLoopRunInMode. According to the documentation, this should return immediately if seconds is 0.

I traced the problem to __CFRunLoopRun where there are a few platform specific cases for draining the message queue. In the TARGET_OS_LINUX case, the polling condition was not being considered.

This PR fixes the parameter to be poll ? 0 : TIMEOUT_INFINITY as is done for the other platforms, which allows polling to work on Android.

@drodriguez
Copy link
Contributor

@swift-ci please test

Copy link
Contributor

@phausler phausler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, it could use a test to verify the appropriate behavior

@bendjones bendjones self-requested a review October 25, 2019 19:53
@bendjones
Copy link
Contributor

Yup same here and agreed about the test...

@Molanda
Copy link
Contributor Author

Molanda commented Oct 26, 2019

I'm building for Ubuntu now to test out the test I added. The result will be pass/hang though.

I did notice that two of the other RunLoop tests are commented out, with a reference to SR-399. This appears to be an issue on Darwin, so I don't see it as related to this fix.

@spevans
Copy link
Contributor

spevans commented Oct 27, 2019

@swift-ci test linux

@Molanda
Copy link
Contributor Author

Molanda commented Oct 31, 2019

Is the test status stuck?

Jenkins is claiming that it was a success.

@spevans
Copy link
Contributor

spevans commented Oct 31, 2019

@Molanda Sometimes the status message from Jenkins -> Github gets lost, i'll start the test again

@spevans
Copy link
Contributor

spevans commented Oct 31, 2019

@swift-ci test linux

@Molanda
Copy link
Contributor Author

Molanda commented Oct 31, 2019

Thank you!

@spevans
Copy link
Contributor

spevans commented Oct 31, 2019

@swift-ci test linux

@Molanda
Copy link
Contributor Author

Molanda commented Oct 31, 2019

Has the build job been changed?

Build 3810 completed successfully on 10/27 with all of my changes. The last step was "Creating installable package".

18:41:50 Setting status of dd402ba04bd324c193a8cc607e03a21c964e9980 to SUCCESS with url https://ci.swift.org/job/swift-corelibs-foundation-PR-Linux/3810/ and message: 'Build finished. '
18:41:50 Using context: Swift Test Linux Platform
18:41:50 Setting status of dd402ba04bd324c193a8cc607e03a21c964e9980 to SUCCESS with url https://ci.swift.org/job/swift-corelibs-foundation-PR-Linux/3810/ and message: ' '
18:41:50 Using context: Swift Test Linux Platform
18:41:50 Finished: SUCCESS

This step has been replaced in Build 3825 with the following...

  • Building indexstoredb
  • Running tests for indexstoredb
  • Finished tests for indexstoredb
  • Building sourcekitlsp
  • Running tests for sourcekitlsp
  • Finished tests for sourcekitlsp
  • Installing sourcekitlsp
  • Building benchmarks

And "Installing swiftpm" now fails with the following error:

21:45:03 IOError: [Errno 2] No such file or directory: '/home/buildnode/jenkins/workspace/swift-corelibs-foundation-PR-Linux/buildbot_linux/benchmarks-linux-x86_64/Benchmark_Onone/debug/SwiftBench'

@drodriguez
Copy link
Contributor

The Swift Package Manager – Benchmarks build error was fixed this morning, after Simon launched the tests.

@swift-ci test linux

@Molanda
Copy link
Contributor Author

Molanda commented Nov 1, 2019

Great, thank you!

@Molanda Molanda requested a review from phausler November 1, 2019 02:17
@Molanda
Copy link
Contributor Author

Molanda commented Nov 19, 2019

What is the next step for this one?

@drodriguez drodriguez merged commit cfd7974 into swiftlang:master Nov 19, 2019
@drodriguez
Copy link
Contributor

Sorry for the delays. I just merged. Congrats!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants