nmdias / FeedKit

An RSS, Atom and JSON Feed parser written in Swift
MIT License
1.19k stars 174 forks source link

Issues Using FeedKit with Docker Ubuntu 18.04 #115

Closed daSkier closed 4 years ago

daSkier commented 4 years ago

Hi,

I'm using FeedKit in a server side vapor 4 app and I'm getting a weird error when using FeedKit and I was curious if you could shed any light on what this might be caused by and if there is anything I can do to resolve it.

For reference I'm using a Swift 5.2.1.

Thanks, J

Fatal error: You must link or load module FoundationNetworking to load non-file: URL content using String(contentsOf:…), Data(contentsOf:…), etc.: file /home/buildnode/jenkins/workspace/oss-swift-5.2-package-linux-ubuntu-18_04/swift-corelibs-foundation/Foundation/NSSwiftRuntime.swift, line 397

Full stack trace:

api_1  | Fatal error: You must link or load module FoundationNetworking to load non-file: URL content using String(contentsOf:…), Data(contentsOf:…), etc.: file /home/buildnode/jenkins/workspace/oss-swift-5.2-package-linux-ubuntu-18_04/swift-corelibs-foundation/Foundation/NSSwiftRuntime.swift, line 397
api_1  | 0x7fb0bb0eb88f
api_1  | 0x7fb0bbc6f625
api_1  | 0x7fb0bb75b4af
api_1  | 0x7fb0bb6ab2d0
api_1  | 0x7fb0bb6ab3c8
api_1  | 0x7fb0bb6a5ea1
api_1  | 0x556dd17549b2, Foundation.NSData.__allocating_init(contentsOf: Foundation.URL, options: Foundation.NSData.ReadingOptions) throws -> Foundation.NSData at /build/<compiler-generated>:0
api_1  | 0x556dd17549b2, Foundation.Data.init(contentsOf: __shared Foundation.URL, options: Foundation.NSData.ReadingOptions) throws -> Foundation.Data at /build/<compiler-generated>:0
api_1  | 0x556dd17549b2, FeedKit.FeedParser.parse() -> Swift.Result<FeedKit.Feed, FeedKit.ParserError> at /build/.build/checkouts/FeedKit/Sources/FeedKit/Parser/FeedParser.swift:74
api_1  | 0x556dd13f45eb, function signature specialization <Arg[0] = Dead> of static App.RSSManager.checkForLatestRSSActivty() -> Swift.Result<FeedKit.Feed, FeedKit.ParserError> at /build/Sources/App/System Managers/RSSManager.swift:20
api_1  | 0x556dd13f4b42, static App.RSSManager.checkForLatestRSSActivty() -> Swift.Result<FeedKit.Feed, FeedKit.ParserError> at /build/<compiler-generated>:0
api_1  | 0x556dd13f4b42, static App.RSSManager.getLatestAlpineFeedItems() -> Swift.Result<Swift.Array<FeedKit.RSSFeedItem>, FeedKit.ParserError> at /build/Sources/App/System Managers/RSSManager.swift:24
api_1  | 0x556dd13f4b42, function signature specialization <Arg[0] = Dead> of static App.RSSManager.getLatestAlpineFeedUrls() -> Swift.Result<Swift.Array<Foundation.URL>, FeedKit.ParserError> at /build/Sources/App/System Managers/RSSManager.swift:37
api_1  | 0x556dd13eca8b, static App.RSSManager.getLatestAlpineFeedUrls() -> Swift.Result<Swift.Array<Foundation.URL>, FeedKit.ParserError> at /build/<compiler-generated>:0
api_1  | 0x556dd13eca8b, static App.FISUpdateManager.checkForNewAlpinePointsListsForDownload(on: FluentKit.Database) -> NIO.EventLoopFuture<Swift.Array<Foundation.URL>> at /build/Sources/App/System Managers/FISUpdateManager.swift:74
api_1  | 0x556dd13eb8e0, static App.FISUpdateManager.downloadNewAlpinePointsLists(on: FluentKit.Database) -> NIO.EventLoopFuture<Swift.Array<()>> at /build/Sources/App/System Managers/FISUpdateManager.swift:33
api_1  | 0x556dd13eb6f8, static App.FISUpdateManager.downloadAndImportNewAlpinePointsLists(on: FluentKit.Database) -> NIO.EventLoopFuture<Swift.Array<()>> at /build/Sources/App/System Managers/FISUpdateManager.swift:20
api_1  | 0x556dd140a6bb, closure #1 (NIO.RepeatedTask) -> NIO.EventLoopFuture<()> in App.configure(Vapor.Application) throws -> () at /build/Sources/App/configure.swift:42
api_1  | 0x556dd1878744, closure #1 () -> NIO.EventLoopFuture<()> in NIO.RepeatedTask.(begin0 in _D5D78C61B22284700B9BD1ACFBC25157)(in: NIO.TimeAmount) -> () at /build/.build/checkouts/swift-nio/Sources/NIO/EventLoop.swift:88
api_1  | 0x556dd1878744, partial apply forwarder for closure #1 () -> NIO.EventLoopFuture<()> in NIO.RepeatedTask.(begin0 in _D5D78C61B22284700B9BD1ACFBC25157)(in: NIO.TimeAmount) -> () at /build/<compiler-generated>:0
api_1  | 0x556dd1878763, reabstraction thunk helper from @escaping @callee_guaranteed () -> (@owned NIO.EventLoopFuture<()>, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out NIO.EventLoopFuture<()>, @error @owned Swift.Error) at /build/<compiler-generated>:0
api_1  | 0x556dd1878763, partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@owned NIO.EventLoopFuture<()>, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out NIO.EventLoopFuture<()>, @error @owned Swift.Error) at /build/<compiler-generated>:0
api_1  | 0x556dd187a128
api_1  | 0x556dd18bea0b, closure #1 () -> () in NIO.SelectableEventLoop.scheduleTask<A>(deadline: NIO.NIODeadline, _: () throws -> A) -> NIO.Scheduled<A> at /build/.build/checkouts/swift-nio/Sources/NIO/SelectableEventLoop.swift:215
api_1  | 0x556dd18c1430, reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> (@out ()) at /build/<compiler-generated>:0
api_1  | 0x556dd18c1430, partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> (@out ()) at /build/<compiler-generated>:0
api_1  | 0x556dd18bdd61, reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out ()) to @escaping @callee_guaranteed () -> () at /build/.build/checkouts/swift-nio/Sources/NIO/SelectableEventLoop.swift:0
api_1  | 0x556dd18bdd61, closure #3 () -> () in NIO.SelectableEventLoop.run() throws -> () at /build/.build/checkouts/swift-nio/Sources/NIO/SelectableEventLoop.swift:430
api_1  | 0x556dd18bdd61, reabstraction thunk helper from @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) at /build/<compiler-generated>:0
api_1  | 0x556dd18bdd61, generic specialization <()> of NIO.withAutoReleasePool<A>(() throws -> A) throws -> A at /build/.build/checkouts/swift-nio/Sources/NIO/SelectableEventLoop.swift:26
api_1  | 0x556dd18bdd61, NIO.SelectableEventLoop.run() throws -> () at /build/.build/checkouts/swift-nio/Sources/NIO/SelectableEventLoop.swift:429
api_1  | 0x556dd18753ea, closure #1 (NIO.NIOThread) -> () in static NIO.MultiThreadedEventLoopGroup.(setupThreadAndEventLoop in _D5D78C61B22284700B9BD1ACFBC25157)(name: Swift.String, selectorFactory: () throws -> NIO.Selector<NIO.NIORegistration>, initializer: (NIO.NIOThread) -> ()) -> NIO.SelectableEventLoop at /build/.build/checkouts/swift-nio/Sources/NIO/EventLoop.swift:753
api_1  | 0x556dd1879e22, partial apply forwarder for closure #1 (NIO.NIOThread) -> () in static NIO.MultiThreadedEventLoopGroup.(setupThreadAndEventLoop in _D5D78C61B22284700B9BD1ACFBC25157)(name: Swift.String, selectorFactory: () throws -> NIO.Selector<NIO.NIORegistration>, initializer: (NIO.NIOThread) -> ()) -> NIO.SelectableEventLoop at /build/<compiler-generated>:0
api_1  | 0x556dd18d6eee, reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed NIO.NIOThread) -> () to @escaping @callee_guaranteed (@in_guaranteed NIO.NIOThread) -> (@out ()) at /build/<compiler-generated>:0
api_1  | 0x556dd1879e40, partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed NIO.NIOThread) -> () to @escaping @callee_guaranteed (@in_guaranteed NIO.NIOThread) -> (@out ()) at /build/<compiler-generated>:0
api_1  | 0x556dd18d8009, closure #1 (Swift.Optional<Swift.UnsafeMutableRawPointer>) -> Swift.Optional<Swift.UnsafeMutableRawPointer> in static NIO.ThreadOpsPosix.run(handle: inout Swift.Optional<Swift.UInt>, args: NIO.Box<(body: (NIO.NIOThread) -> (), name: Swift.Optional<Swift.String>)>, detachThread: Swift.Bool) -> () at /build/.build/checkouts/swift-nio/Sources/NIO/ThreadPosix.swift:97
api_1  | 0x7fb0bb0e06da
api_1  | 0x7fb0b906c88e
api_1  | 0xffffffffffffffff
psvaporv4_api_1 exited with code 132
ghost commented 4 years ago

Hi!

I'm unable to boot a linux instance right now, can you try this for me please? In the FeedParser.swift file add:

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

According to the documentation here this should fix it.

If so, feel free to open a PR and I'll release a new version with the fix.

Thanks 🙏

daSkier commented 4 years ago

I'll look at opening a PR for this. I did try that from the file where I call FeedKit and it did resolve that issue. Unfortunately, that caused another error that I'm not familiar with, nor receiving on macOS as follows:

api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)
api_1  | error: hit flatMapError in objectsInBucket() -> The operation could not be completed. (SwiftError error 0.)

I'll have to work on debugging this because at first glance it seems like it could be in FeedKit, but I'm 100% sure.

Thanks for the quick response on a weekend. -J

daSkier commented 4 years ago

Update: I'm pretty sure this subsequent error is not caused by FeedKit. I'll look at the PR for the first issue today.

daSkier commented 4 years ago

@tarjamorgado I opened a PR for this #116 - I'm not sure if this actually needs to be implemented other places, but this has fixed the issue I was experiencing.

ghost commented 4 years ago

Released your fix in 9.1.2, closing now. Thank you for contributing @daSkier