[swift-corelibs-dev] Encountering "Constant strings cannot be deallocated" in Linux foundation

2017-11-29 Thread Brandon Williams via swift-corelibs-dev
Hello all! We’ve been encountering this runtime error quite a bit recently, and we have no idea why. We’ve filed a bug and there’s one other on JIRA related to this, but both without any comments: https://bugs.swift.org/browse/SR-6422 https://bugs.swift.org/browse/SR-6398 We’re curious if others

Re: [swift-corelibs-dev] Encountering "Constant strings cannot be deallocated" in Linux foundation

2017-11-29 Thread Tony Parker via swift-corelibs-dev
Hi Brandon, This is probably a bug in the CoreFoundation C sources part of swift-corelibs-foundation. Unlike Darwin platforms, we can’t make the CFSTR(“”) macro produce a CFStringRef that cannot be overreleased. Probably there is a constant string returned from CF function, then the Swift runti

Re: [swift-corelibs-dev] Encountering "Constant strings cannot be deallocated" in Linux foundation

2017-11-29 Thread Brandon Williams via swift-corelibs-dev
Thanks for the info! FWIW, most of the places I have encountered this so far have made use of `URLComponents`, and have even been able to eliminate the crash by getting rid of that code in a few places. The other JIRA bug on this topic also mentions URLComponents in their repro case. Seems to be t

Re: [swift-corelibs-dev] Encountering "Constant strings cannot be deallocated" in Linux foundation

2017-11-29 Thread Tony Parker via swift-corelibs-dev
I see a couple of places that are suspicious there: Description: https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/URL.subproj/CFURLComponents.c#L66 And

Re: [swift-corelibs-dev] Encountering "Constant strings cannot be deallocated" in Linux foundation

2017-11-29 Thread Brandon Williams via swift-corelibs-dev
Hey Tony, We were able to fix our crashes by avoiding our uses of `URLQueryItem`s. In one place I had to completely remove the use of `URLQueryItem`: https://github.com/pointfreeco/swift-web/pull/79/files#diff-293b73a926ba418bd9511ef735fc947cL147 And in another my colleague Stephen Celis discove

Re: [swift-corelibs-dev] Encountering "Constant strings cannot be deallocated" in Linux foundation

2017-11-29 Thread Philippe Hausler via swift-corelibs-dev
I think that perhaps we have a problem with the retain count flags in the definition of CFSTR. Previously the pinned reference would prevent the deallocation. This may have gotten clobbered with the latest CF import. Sent from my iPhone > On Nov 29, 2017, at 7:55 PM, Brandon Williams via swift-