IBM-Swift / swift-buildpack

IBM Cloud buildpack for Swift
BSD 3-Clause "New" or "Revised" License
32 stars 31 forks source link

All of my apps are suddenly broken (OpenSSL issue?) #117

Closed svanimpe closed 5 years ago

svanimpe commented 5 years ago

All of my apps on IBM Cloud suddenly stopped working. I am unable to restart them as my code no longer compiles.

Here's my output when I attempt to push the app again:

Staging app and tracing logs...
   Downloading swift_buildpack...
   Downloaded swift_buildpack
   Cell 93b00c5c-012c-4501-aa85-748d9f1b1064 creating container for instance 7520b7c8-e297-4c04-baba-43f5b89d04d2
   Cell 93b00c5c-012c-4501-aa85-748d9f1b1064 successfully created container for instance 7520b7c8-e297-4c04-baba-43f5b89d04d2
   Downloading app package...
   Downloaded app package (20.2M)
   -----> Buildpack version 2.1.0
   -----> Default supported Swift version is 5.0
   -----> Configure for apt-get installs...
   -----> Writing profile script...
   -----> Copying deb files to installation folder...
   -----> No Aptfile found.
   -----> Getting swift-4.2.4
   -----> WARNING: Default supported Swift version: swift-5.0
   -----> WARNING: Requested Swift version for your app: swift-4.2.4
          Cached swift-4.2.4
   -----> Unpacking swift-4.2.4.tar.gz
   -----> Getting clang-8.0.0
          Cached clang-8.0.0
   -----> Unpacking clang-8.0.0.tar.xz
   -----> .ssh directory and config file not found.
   -----> Skipping cache restore (disabled by config)
   -----> Fetching Swift packages and parsing Package.swift files...
          Fetching https://github.com/IBM-Swift/swift-html-entities
          Fetching https://github.com/kylef/Stencil.git
          Fetching https://github.com/IBM-Swift/HeliumLogger.git
          Fetching https://github.com/OpenKitten/CryptoKitten.git
          Fetching https://github.com/IBM-Swift/Kitura-TemplateEngine.git
          Fetching https://github.com/OpenKitten/BSON.git
          Fetching https://github.com/IBM-Swift/Configuration.git
          Fetching https://github.com/IBM-Swift/Kitura.git
          Fetching https://github.com/IBM-Swift/Kitura-Session.git
          Fetching https://github.com/OpenKitten/Schrodinger.git
          Fetching https://github.com/IBM-Swift/Kitura-Credentials.git
          Fetching https://github.com/IBM-Swift/Health.git
          Fetching https://github.com/IBM-Swift/Kitura-StencilTemplateEngine.git
          Fetching https://github.com/IBM-Swift/Kitura-CredentialsFacebook.git
          Fetching https://github.com/IBM-Swift/SwiftyRequest.git
          Fetching https://github.com/IBM-Swift/TypeDecoder.git
          Fetching https://github.com/IBM-Swift/CircuitBreaker.git
          Fetching https://github.com/kylef/PathKit.git
          Fetching https://github.com/IBM-Swift/BlueSSLService.git
          Fetching https://github.com/IBM-Swift/FileKit.git
          Fetching https://github.com/OpenKitten/MongoKitten.git
          Fetching https://github.com/IBM-Swift/BlueSocket.git
          Fetching https://github.com/IBM-Swift/LoggerAPI.git
          Fetching https://github.com/IBM-Swift/KituraContracts.git
          Fetching https://github.com/IBM-Swift/Kitura-net.git
          Fetching https://github.com/IBM-Swift/Swift-cfenv.git
          Fetching https://github.com/IBM-Swift/BlueCryptor.git
          Fetching https://github.com/OpenKitten/Cheetah.git
          Fetching https://github.com/kylef/Spectre.git
          Fetching https://github.com/IBM-Swift/BlueSignals.git
          Fetching https://github.com/IBM-Swift/OpenSSL.git
          Fetching https://github.com/OpenKitten/KittenCTLS.git
   Completed resolution in 16.32s
          Cloning https://github.com/IBM-Swift/Kitura-CredentialsFacebook.git
          Resolving https://github.com/IBM-Swift/Kitura-CredentialsFacebook.git at 2.2.3
          Cloning https://github.com/IBM-Swift/Configuration.git
          Resolving https://github.com/IBM-Swift/Configuration.git at 3.0.2
          Cloning https://github.com/IBM-Swift/HeliumLogger.git
          Resolving https://github.com/IBM-Swift/HeliumLogger.git at 1.8.0
          Cloning https://github.com/IBM-Swift/FileKit.git
          Resolving https://github.com/IBM-Swift/FileKit.git at 0.0.1
          Cloning https://github.com/kylef/Spectre.git
          Resolving https://github.com/kylef/Spectre.git at 0.9.0
          Cloning https://github.com/OpenKitten/Cheetah.git
          Resolving https://github.com/OpenKitten/Cheetah.git at 2.0.2
          Cloning https://github.com/IBM-Swift/BlueCryptor.git
          Resolving https://github.com/IBM-Swift/BlueCryptor.git at 1.0.23
          Cloning https://github.com/OpenKitten/MongoKitten.git
          Resolving https://github.com/OpenKitten/MongoKitten.git at 4.1.3
          Cloning https://github.com/IBM-Swift/Kitura-net.git
          Resolving https://github.com/IBM-Swift/Kitura-net.git at 2.1.6
          Cloning https://github.com/IBM-Swift/CircuitBreaker.git
          Resolving https://github.com/IBM-Swift/CircuitBreaker.git at 5.0.1
          Cloning https://github.com/IBM-Swift/Kitura-TemplateEngine.git
          Resolving https://github.com/IBM-Swift/Kitura-TemplateEngine.git at 2.0.0
          Cloning https://github.com/IBM-Swift/TypeDecoder.git
          Resolving https://github.com/IBM-Swift/TypeDecoder.git at 1.3.0
          Cloning https://github.com/kylef/PathKit.git
          Resolving https://github.com/kylef/PathKit.git at 0.9.2
          Cloning https://github.com/IBM-Swift/OpenSSL.git
          Resolving https://github.com/IBM-Swift/OpenSSL.git at 2.2.2
          Cloning https://github.com/IBM-Swift/swift-html-entities
          Resolving https://github.com/IBM-Swift/swift-html-entities at 3.0.10
          Cloning https://github.com/IBM-Swift/Kitura.git
          Resolving https://github.com/IBM-Swift/Kitura.git at 2.6.0
          Cloning https://github.com/kylef/Stencil.git
          Resolving https://github.com/kylef/Stencil.git at 0.13.1
          Cloning https://github.com/IBM-Swift/Health.git
          Resolving https://github.com/IBM-Swift/Health.git at 1.0.4
          Cloning https://github.com/OpenKitten/BSON.git
          Resolving https://github.com/OpenKitten/BSON.git at 5.2.4
          Cloning https://github.com/OpenKitten/CryptoKitten.git
          Resolving https://github.com/OpenKitten/CryptoKitten.git at 0.2.3
          Cloning https://github.com/IBM-Swift/Swift-cfenv.git
          Resolving https://github.com/IBM-Swift/Swift-cfenv.git at 6.0.2
          Cloning https://github.com/IBM-Swift/BlueSignals.git
          Resolving https://github.com/IBM-Swift/BlueSignals.git at 1.0.20
          Cloning https://github.com/IBM-Swift/Kitura-Credentials.git
          Resolving https://github.com/IBM-Swift/Kitura-Credentials.git at 2.3.1
          Cloning https://github.com/IBM-Swift/BlueSSLService.git
          Resolving https://github.com/IBM-Swift/BlueSSLService.git at 1.0.44
          Cloning https://github.com/OpenKitten/KittenCTLS.git
          Resolving https://github.com/OpenKitten/KittenCTLS.git at 1.0.1
          Cloning https://github.com/IBM-Swift/Kitura-StencilTemplateEngine.git
          Resolving https://github.com/IBM-Swift/Kitura-StencilTemplateEngine.git at 1.11.0
          Cloning https://github.com/IBM-Swift/SwiftyRequest.git
          Resolving https://github.com/IBM-Swift/SwiftyRequest.git at 2.0.3
          Cloning https://github.com/IBM-Swift/BlueSocket.git
          Resolving https://github.com/IBM-Swift/BlueSocket.git at 1.0.44
          Cloning https://github.com/OpenKitten/Schrodinger.git
          Resolving https://github.com/OpenKitten/Schrodinger.git at 1.0.1
          Cloning https://github.com/IBM-Swift/KituraContracts.git
          Resolving https://github.com/IBM-Swift/KituraContracts.git at 1.1.1
          Cloning https://github.com/IBM-Swift/Kitura-Session.git
          Resolving https://github.com/IBM-Swift/Kitura-Session.git at 3.3.0
          Cloning https://github.com/IBM-Swift/LoggerAPI.git
          Resolving https://github.com/IBM-Swift/LoggerAPI.git at 1.8.0
   -----> Additional packages to download: openssl
   -----> openssl is already installed.
   -----> No additional packages to download.
   -----> Skipping installation of App Management (debug)
   -----> Installing system level dependencies...
   -----> Building Package...
   -----> Build config: release
   warning: PackageDescription API v3 is deprecated and will be removed in the future; used by package(s): MongoKitten, KittenCTLS, Schrodinger, CryptoKitten, Cheetah, BSON, HTMLEntities
          Compile CHTTPParser utils.c
          Compile CHTTPParser http_parser.c
          Compile Swift Module 'LoggerAPI' (1 sources)
          Compile Swift Module 'TypeDecoder' (2 sources)
          Compile Swift Module 'Socket' (3 sources)
          Compile Swift Module 'Signals' (1 sources)
          Compile Swift Module 'Schrodinger' (1 sources)
          Compile Swift Module 'PathKit' (1 sources)
          Compile Swift Module 'KituraTemplateEngine' (1 sources)
          Compile Swift Module 'KituraContracts' (9 sources)
          Compile Swift Module 'HeliumLogger' (2 sources)
          Compile Swift Module 'Stencil' (20 sources)
          Compile Swift Module 'SSLService' (2 sources)
          Compile Swift Module 'Health' (3 sources)
          Compile Swift Module 'HTMLEntities' (4 sources)
          Compile Swift Module 'KituraNet' (36 sources)
          Compile Swift Module 'FileKit' (1 sources)
          Compile Swift Module 'Cryptor' (11 sources)
          Compile Swift Module 'KituraStencil' (1 sources)
          Compile Swift Module 'CryptoKitten' (10 sources)
          Compile Swift Module 'Configuration' (5 sources)
          Compile Swift Module 'Kitura' (52 sources)
          Compile Swift Module 'CircuitBreaker' (10 sources)
          Compile Swift Module 'Cheetah' (7 sources)
          /tmp/app/.build/checkouts/CryptoKitten.git--8745850272021827022/Sources/CryptoKitten/Helpers.swift:3:61: warning: 'IndexDistance' is deprecated: all index distances are now of type Int
          extension Swift.Collection where Iterator.Element == UInt8, IndexDistance == Int {
                                                                      ^
          /tmp/app/.build/checkouts/CryptoKitten.git--8745850272021827022/Sources/CryptoKitten/Helpers.swift:3:75: warning: neither type in same-type constraint ('Self.IndexDistance' (aka 'Int') or 'Int') refers to a generic parameter or associated type
          extension Swift.Collection where Iterator.Element == UInt8, IndexDistance == Int {
                                                                      ~~~~~~~~~~~~~ ^  ~~~
          /tmp/app/.build/checkouts/CryptoKitten.git--8745850272021827022/Sources/CryptoKitten/Helpers.swift:3:61: warning: 'IndexDistance' is deprecated: all index distances are now of type Int
          extension Swift.Collection where Iterator.Element == UInt8, IndexDistance == Int {
                                                                      ^
          /tmp/app/.build/checkouts/CryptoKitten.git--8745850272021827022/Sources/CryptoKitten/Helpers.swift:3:61: warning: 'IndexDistance' is deprecated: all index distances are now of type Int
          extension Swift.Collection where Iterator.Element == UInt8, IndexDistance == Int {
                                                                      ^
          Compile Swift Module 'CloudFoundryEnv' (6 sources)
          Compile Swift Module 'BSON' (21 sources)
          Compile Swift Module 'SwiftyRequest' (10 sources)
          /tmp/app/.build/checkouts/Cheetah.git--346028729905725053/Sources/Cheetah/Codable.swift:655:43: warning: 'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value
                  return decoder.target.object.keys.flatMap { Key(stringValue: $0) }
                                                    ^
          /tmp/app/.build/checkouts/Cheetah.git--346028729905725053/Sources/Cheetah/Codable.swift:655:43: note: use 'compactMap(_:)' instead
                  return decoder.target.object.keys.flatMap { Key(stringValue: $0) }
                                                    ^~~~~~~
                                                    compactMap
          /tmp/app/.build/checkouts/Cheetah.git--346028729905725053/Sources/Cheetah/Parser.swift:219:47: warning: 'characters' is deprecated: Please use String or Substring directly
                      if negate && autoNegate && prefix.characters.first != "-" {
                                                        ^
          /tmp/app/.build/checkouts/Cheetah.git--346028729905725053/Sources/Cheetah/Parser.swift:231:26: warning: 'characters' is deprecated: Please use String or Substring directly
                      guard number.characters.count > 0 else {
                                   ^
          /tmp/app/.build/checkouts/Cheetah.git--346028729905725053/Sources/Cheetah/Value.swift:103:24: warning: 'characters' is deprecated: Please use String or Substring directly
                          if str.characters.count == 1 {
                                 ^
          /tmp/app/.build/checkouts/Cheetah.git--346028729905725053/Sources/Cheetah/Value.swift:170:26: warning: 'flatMap' is deprecated: Please use compactMap(_:) for the case where closure returns an optional value
                  let array = self.flatMap { value -> CheetahValue? in
                                   ^
          /tmp/app/.build/checkouts/Cheetah.git--346028729905725053/Sources/Cheetah/Value.swift:170:26: note: use 'compactMap(_:)' instead
                  let array = self.flatMap { value -> CheetahValue? in
                                   ^~~~~~~
                                   compactMap
          /tmp/app/.build/checkouts/BSON.git--6126586813750914861/Sources/BSON/DeserializationHelpers.swift:3:104: warning: 'IndexDistance' is deprecated: all index distances are now of type Int
          internal func fromBytes<T, S : Collection>(_ bytes: S) throws -> T where S.Iterator.Element == Byte, S.IndexDistance == Int {
                                                                                                                 ^
          /tmp/app/.build/checkouts/BSON.git--6126586813750914861/Sources/BSON/Document+Subscripts.swift:242:54: warning: 'characters' is deprecated: Please use String or Substring directly
                      position = stringPosition + newValue.key.characters.count + 1
                                                               ^
          /tmp/app/.build/checkouts/BSON.git--6126586813750914861/Sources/BSON/ObjectId.swift:76:25: warning: 'characters' is deprecated: Please use String or Substring directly
                  guard hexString.characters.count == 24 else {
                                  ^
          /tmp/app/.build/checkouts/BSON.git--6126586813750914861/Sources/BSON/ObjectId.swift:82:29: warning: 'characters' is deprecated: Please use String or Substring directly
                  var gen = hexString.characters.makeIterator()
                                      ^
          Compile Swift Module 'MongoSocket' (2 sources)
          Compile Swift Module 'GeoJSON' (11 sources)
          Compile Swift Module 'ExtendedJSON' (2 sources)
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:32:49: error: use of undeclared type 'SSL'
              private let sslClient: UnsafeMutablePointer<SSL>?
                                                          ^~~
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:33:42: error: use of undeclared type 'SSL_METHOD'
              private let sslMethod: UnsafePointer<SSL_METHOD>?
                                                   ^~~~~~~~~~
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:34:50: error: use of undeclared type 'SSL_CTX'
              private let sslContext: UnsafeMutablePointer<SSL_CTX>?
                                                           ^~~~~~~
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:217:21: error: use of unresolved identifier 'SSL_library_init'
                              SSL_library_init()
                              ^~~~~~~~~~~~~~~~
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:218:21: error: use of unresolved identifier 'SSL_load_error_strings'; did you mean 'ERR_lib_error_string'?
                              SSL_load_error_strings()
                              ^~~~~~~~~~~~~~~~~~~~~~
                              ERR_lib_error_string
          KittenCTLS.ERR_lib_error_string:1:13: note: 'ERR_lib_error_string' declared here
          public func ERR_lib_error_string(_ e: UInt) -> UnsafePointer<Int8>!
                      ^
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:219:21: warning: 'OPENSSL_config' is deprecated
                              OPENSSL_config(nil)
                              ^
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:220:21: error: use of unresolved identifier 'OPENSSL_add_all_algorithms_conf'
                              OPENSSL_add_all_algorithms_conf()
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:224:30: error: use of unresolved identifier 'SSLv23_client_method'
                          let method = SSLv23_client_method()
                                       ^~~~~~~~~~~~~~~~~~~~
          KittenCTLS.DTLS_client_method:1:13: note: did you mean 'DTLS_client_method'?
          public func DTLS_client_method() -> OpaquePointer!
                      ^
          KittenCTLS.DTLSv1_client_method:2:13: note: did you mean 'DTLSv1_client_method'?
          public func DTLSv1_client_method() -> OpaquePointer!
                      ^
          KittenCTLS.TLS_client_method:1:13: note: did you mean 'TLS_client_method'?
          public func TLS_client_method() -> OpaquePointer!
                      ^
          KittenCTLS.TLSv1_client_method:2:13: note: did you mean 'TLSv1_client_method'?
          public func TLSv1_client_method() -> OpaquePointer!
                      ^
          /tmp/app/.build/checkouts/MongoKitten.git-8286272547337349665/Sources/MongoSocket/Socket.swift:234:35: error: use of unresolved identifier 'SSL_CTRL_OPTIONS'
                          SSL_CTX_ctrl(ctx, SSL_CTRL_OPTIONS, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION, nil)
                                            ^~~~~~~~~~~~~~~~
          KittenCTLS.SSL_CTRL_CHAIN:1:12: note: did you mean 'SSL_CTRL_CHAIN'?
          public var SSL_CTRL_CHAIN: Int32 { get }
                     ^
          KittenCTLS.SSL_CTRL_SET_MTU:1:12: note: did you mean 'SSL_CTRL_SET_MTU'?
          public var SSL_CTRL_SET_MTU: Int32 { get }
                     ^
   error: terminated(1): /tmp/cache/final/swift-4.2.4/swift-4.2.4-RELEASE-ubuntu18.04/usr/bin/swift-build-tool -f /tmp/app/.build/release.yaml main output:

   Failed to compile droplet: Failed to compile droplet: exit status 1
   Exit status 223
   Cell 93b00c5c-012c-4501-aa85-748d9f1b1064 stopping instance 7520b7c8-e297-4c04-baba-43f5b89d04d2
   Cell 93b00c5c-012c-4501-aa85-748d9f1b1064 destroying container for instance 7520b7c8-e297-4c04-baba-43f5b89d04d2
Error staging application: App staging failed in the buildpack compile phase
FAILED

This app worked fine until this morning.

svanimpe commented 5 years ago

Note that this is unrelated to MongoKitten. For another app, it's the IBM OpenSSL package that compiles with the same errors.

svanimpe commented 5 years ago

Seems like this is caused by many packages still requiring OpenSSL 1.0, whereas IBM Cloud now uses OpenSSL 1.1. I've been able to fix some apps by bumping versions.

christiancompton commented 5 years ago

@svanimpe Thank you for investigating this. Given that OpenSSL 1.0 is used by many Swift apps, I will ask the foundational team whether this can be specified easily.