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

Update AsyncProcess with bug fixes #156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Namely, this works around following issues in `Foundation.Process`:
 - "Foundation.Process on Linux throws error Error Domain=NSCocoaErrorDomain Code=256 "(null)" if executable not found"
   swiftlang/swift-corelibs-foundation#4810
 - "Foundation.Process on Linux doesn't correctly detect when child process dies (creating zombie processes)"
   swiftlang/swift-corelibs-foundation#4795
 - "Foundation.Process on Linux seems to inherit the Process.run()-calling thread's signal mask, even SIGTERM blocked"
   swiftlang/swift-corelibs-foundation#4772
@MaxDesiatov MaxDesiatov added bug Something isn't working dependencies Changes to dependencies labels Nov 27, 2024
@MaxDesiatov MaxDesiatov requested a review from euanh November 27, 2024 14:50
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@euanh
Copy link
Contributor

euanh commented Nov 27, 2024

Swift main run has Swift 6.0 concurrency errors:

/code/Tests/AsyncProcessTests/IntegrationTests.swift:1117:12: error: reference to var 'stdout' is not concurrency-safe because it involves shared mutable state
1115 | 
1116 |   override func setUp() async throws {
1117 |     fflush(stdout)
     |            `- error: reference to var 'stdout' is not concurrency-safe because it involves shared mutable state
1118 |     fflush(stderr)
1119 |     self.group = MultiThreadedEventLoopGroup(numberOfThreads: 3)

/usr/include/stdio.h:144:14: note: var declared here
142 | /* Standard streams.  */
143 | extern FILE *stdin;		/* Standard input stream.  */
144 | extern FILE *stdout;		/* Standard output stream.  */
    |              `- note: var declared here
145 | extern FILE *stderr;		/* Standard error output stream.  */
146 | /* C89/C99 say they're macros.  Make them happy.  */

/code/Tests/AsyncProcessTests/IntegrationTests.swift:1118:12: error: reference to var 'stderr' is not concurrency-safe because it involves shared mutable state
1116 |   override func setUp() async throws {
1117 |     fflush(stdout)
1118 |     fflush(stderr)
     |            `- error: reference to var 'stderr' is not concurrency-safe because it involves shared mutable state
1119 |     self.group = MultiThreadedEventLoopGroup(numberOfThreads: 3)
1120 |     self.logger = Logger(label: "test", factory: { _ in SwiftLogNoOpLogHandler() })

/usr/include/stdio.h:145:14: note: var declared here
143 | extern FILE *stdin;		/* Standard input stream.  */
144 | extern FILE *stdout;		/* Standard output stream.  */
145 | extern FILE *stderr;		/* Standard error output stream.  */
    |              `- note: var declared here
146 | /* C89/C99 say they're macros.  Make them happy.  */
147 | #define stdin stdin

@euanh
Copy link
Contributor

euanh commented Nov 27, 2024

Swift 5.9 run fails in the runaway child processes test:

Test Case 'IntegrationTests.testCanDealWithRunawayChildProcesses' started at 2024-11-27 14:51:18.741
2024-11-27T14:51:18+0000 error x : [AsyncProcessTests] kill didn't fail on attempt 0, trying again...
2024-11-27T14:51:18+0000 error x : [AsyncProcessTests] kill didn't fail on attempt 1, trying again...
2024-11-27T14:51:18+0000 error x : [AsyncProcessTests] kill didn't fail on attempt 2, trying again...
2024-11-27T14:51:19+0000 error x : [AsyncProcessTests] kill didn't fail on attempt 3, trying again...
2024-11-27T14:51:19+0000 error x : [AsyncProcessTests] kill didn't fail on attempt 4, trying again...
2024-11-27T14:51:19+0000 error x : [AsyncProcessTests] kill didn't fail on attempt 5, trying again...
/code/Tests/AsyncProcessTests/IntegrationTests.swift:1066: error: IntegrationTests.testCanDealWithRunawayChildProcesses : XCTAssertEqual failed: ("-1") is not equal to ("0") -
/code/Tests/AsyncProcessTests/IntegrationTests.swift:1067: error: IntegrationTests.testCanDealWithRunawayChildProcesses : XCTAssertEqual failed: ("3") is not equal to ("2") -
Test Case 'IntegrationTests.testCanDealWithRunawayChildProcesses' failed (0.606 seconds)

@MaxDesiatov
Copy link
Contributor Author

cc @weissi

@weissi
Copy link
Contributor

weissi commented Nov 28, 2024

Swift main run has Swift 6.0 concurrency errors:

/code/Tests/AsyncProcessTests/IntegrationTests.swift:1117:12: error: reference to var 'stdout' is not concurrency-safe because it involves shared mutable state

@euanh That's a bug in the Glibc module in Swift for Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Changes to dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants