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

App crashing on boot #78

Open
philipengberg opened this issue Sep 24, 2024 · 10 comments
Open

App crashing on boot #78

philipengberg opened this issue Sep 24, 2024 · 10 comments

Comments

@philipengberg
Copy link

Out of the blue I get this error when my server instance boots on Heroku:

Run: error while loading shared libraries: libswiftCore.so: cannot open shared object file: No such file or directory

This is the buildpack I'm using:

https://buildpack-registry.s3.amazonaws.com/buildpacks/vapor/vapor.tgz

I'm using Heroku-20 stack.

@philipengberg
Copy link
Author

This is the start of the build log:

-----> Building on the Heroku-20 stack
-----> Using buildpack: vapor/vapor
-----> Swift app detected
-----> Using Swift 6.0 (default)
-----> Installing swiftenv
-----> Installing Swift 6.0
Downloading https://swift.org/builds/swift-6.0-release/ubuntu2004/swift-6.0-RELEASE/swift-6.0-RELEASE-ubuntu20.04.tar.gz
/tmp/swiftenv-6.0- /tmp/codon/tmp/buildpacks/2c03c92bc6b8e2a37603d34bfa3d352f037ddcc4

Bare in mind, I don't know if this is the right place to report this.

@vzsg
Copy link
Member

vzsg commented Sep 24, 2024

You're at the right place.


And the issue is perplexing. That file should not be necessary since I included the --static-swift-stdlib argument for swift build... But apparently there is a constellation in which this is not enough. Does your project have any exotic dependencies? Macros, swift-syntax, anything else?


If Swift 6.0 is not a hard requirement, you could fall back to the old version of the buildpack that kept the Swift dynamic libraries in the image for now:

heroku buildpacks:set https://github.com/vapor-community/heroku-buildpack.git#5101-release

In the mean time, I'll probably add a flag that reverts to the old behavior.

@vzsg
Copy link
Member

vzsg commented Sep 24, 2024

Alternatively, could you try bumping the stack to heroku-22 or heroku-24? Both would be interesting data points.

@philipengberg
Copy link
Author

philipengberg commented Sep 24, 2024

I'll try heroku-22 first ☁️ (I tried it earlier, where it never finished building)

@philipengberg
Copy link
Author

Yes, heroku-22 just stalls building with this as the last thing in the log:

[1809/1811] Compiling Run main.swift
[1809/1811] Write Objects.LinkFileList

@philipengberg
Copy link
Author

I'll try the old version of the buildpack now

@philipengberg
Copy link
Author

The downgrade on the buildpack seems to work 👀 Why though? 😅

@MahdiBM
Copy link

MahdiBM commented Sep 24, 2024

@philipengberg looks like the Swift 6 build regression I've reported here: swiftlang/swift#76555

So downgrading the Swift compiler version enabled the builder to not run out of memory.

@philipengberg
Copy link
Author

Interesting! Makes sense.

@vzsg
Copy link
Member

vzsg commented Sep 30, 2024

I've pushed two relevant releases to the buildpack.

If you switch back to vapor/vapor now, you'll get:

  • the option to try Swift 6.0.1 (the new default);
  • and the old dynamic linking behavior if you enable it with heroku config:set SWIFT_DYNAMIC_STDLIB=true.

Anecdotally, dynamic linking has required less memory than static linking, so it might be worth a try.
It would be a very interesting data point too, if you could test this new option with 5.10.1 and 6.0.1.


tl;dr:

heroku buildpacks:set vapor/vapor
heroku config:set SWIFT_DYNAMIC_STDLIB=true
git push heroku main

☝🏻 should result in a successful build even with Swift 6.

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

No branches or pull requests

3 participants