Swift for Linux debug vs. release configuration, any recommendations?

Hello everybody,

I have a fairly large C based code based backed that I successfully wrapped into nice small swift packages around swift 2 timeframe, and has been using dockerized in production ever since. Even before the swift docker images were official. Huge memory savings and performance gains, clean workflow, so I never want to go back. Thanks everybody working on swift and swift pm.

I remember in the past that I had to build using swift build --configuration debug otherwise the executable would be crashing randomly with cryptic stack traces. Apparently due to bugs in optimization. This has improved and at some point in time and I remember finally switching to swift build --configuration release around swift 4.

In production, surviving many docker rebuilds and point release updates of swift compiler and various dependent components everything was shiny and happy until this week when I tried to swift build --configuration release using swift 5.1.1.

The app started behaving strangely - not crashing - but is apparently hitting either memory corruption, or some kind of low level logic bugs.

Problems fixed by using swift build --configuration debug as in the past, or by moving back to swift 5.4.3 which works super stable in production in release mode. Like 100 days of uptime under serious load with no troubles.

I could not yet track down precisely what is happening, to figure out whether this is a mistake on my side or a bug in linux swift, but I am looking for a general advice from like minded people running swift on the server.

  1. Should I stick to swift build --configuration debug to make sure my code on Linux is functionally correct and stable? Does anybody use --configuration release reliably?

  2. Is there a place to automatically follow/track bugs and issues reported against swift/linux so that I am aware of the current state?

I am comfortable living on the bleeding edge, I am just trying to figure out some best practices.

thanks,
Martin

For one - definitely run in release configuration. You should see huge performance improvements compared to debug. I use it for tens of server-side Swift client problems with no issue.

For 2 - bugs are on bugs.swift.org but finding out what is a Linux issue and what is fixed it what release (including the Linux only patch releases) is definitely something that can be improved

4 Likes
Terms of Service

Privacy Policy

Cookie Policy