[swift-users] Is URLSession actually working on Linux

Alex Blewitt alblue at apple.com
Wed Oct 4 03:48:33 CDT 2017

> On 3 Oct 2017, at 19:15, Geordie Jay via swift-users <swift-users at swift.org> wrote:
> 2017-10-03 20:10 GMT+02:00 Georgios Moschovitis via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>>:
> I implemented a simple RSS feed aggregator. I used code like...
> let data = try! Data(contentsOf: feedURL)
> or
> let session = URLSession(configuration: URLSessionConfiguration.default)
> let task = session.dataTask(with: url, completionHandler: completionHandler)
> task.resume()
> ...to fetch the data.
> While my application worked perfectly when running on macOS, when I tried to run
> it on Ubuntu it started crashing randomly with errors like...
> *** Error in `bin/….': double free or corruption (fasttop): 0x00007f3880000ff0 ***
> Aborted

There were some issues which were fixed on the swift-4 branch but which didn't make it in before the swift 4.0 release was cut. These fixes will be in the next point release of Swift.

Have you tried the code with the latest nightly build to verify whether that has fixed the issue you're seeing?

> Are there any issues with the implementation of Foundation for Linux?
> tldr; Pretty sure, yes.

There has been a reasonable amount of work put in recently, particularly with Data and URLSession. 

You can have a look at the list of open issues for Foundation on Linux:


Note that some of the issues may have been recently closed but not made it into a release.

One of my colleagues recently fixed an issue with concurrent data races, which has a similar effect to the one you're describing but may not be the same:

https://bugs.swift.org/browse/SR-5936 <https://bugs.swift.org/browse/SR-5936>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171004/d07b9e60/attachment.html>

More information about the swift-users mailing list