[swift-corelibs-dev] [swift-users] DateFormatter crash on second usage (new instance) on Linux (swift 3.0.1)

Philippe Hausler phausler at apple.com
Thu Jan 26 09:14:36 CST 2017


You are probably missing the package libblocksruntime-dev. That would cause that failure.

Sent from my iPhone

> On Jan 26, 2017, at 6:33 AM, Dennis Schafroth <dennis at schafroth.com> wrote:
> 
> Thanks for the suggestions. 
> 
> It works with 3.0.2 but won't compile with 3.1 beta for Ubuntu 14.04. Missing a Block.h which does exist in 3.0.2
> 
> :-Dennis
> 
>> On 26 Jan 2017, at 05.20, Philippe Hausler <phausler at apple.com> wrote:
>> 
>> We should run those tests with ASAN, I thought I had fixed that with the Sierra merge.
>> 
>> Sent from my iPhone
>> 
>>> On Jan 25, 2017, at 6:11 PM, Will Stanton via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
>>> 
>>> Based on the backtrace, I think the code is running into a memory issue with Swift Foundation:
>>> https://bugs.swift.org/browse/SR-2485
>>> https://bugs.swift.org/browse/SR-2462
>>> 
>>> I haven’t seen this in a while - are you able to try running on Swift 3.1 or 3.0.2?
>>> Your code seems to work on the IBM Sandbox with 3.0.2 but not 3.0.1.
>>> You could also try replacing every 'let’ with ‘var’ but that might not be the right solution :-)
>>> 
>>> Regards,
>>> Will Stanton
>>> 
>>>> On Jan 25, 2017, at 5:04 PM, Dennis Schafroth via swift-users <swift-users at swift.org> wrote:
>>>> 
>>>> Hi
>>>> 
>>>> Trying to do some simple date parsing from syslog format (“Jan 25 20:21:22”) into Date. Seem to work once but crashes on second call
>>>> 
>>>> 
>>>> func dateConv(_ dateString: String) -> Date? {
>>>> let dateFormatter = DateFormatter()
>>>> dateFormatter.dateFormat = "MMM dd HH:mm"
>>>> dateFormatter.locale = Locale(identifier: "da_DK_POSIX")
>>>> if let date = dateFormatter.date(from: dateString) {
>>>>  print("Real date: \(date)" )
>>>>  return date
>>>> }
>>>> return nil
>>>> }
>>>> 
>>>> var date  = dateConv("Jan 25 20:10")
>>>> var date2 = dateConv("Jan 25 20:11”)
>>>> 
>>>> # swift main.swift
>>>> Real date: 2000-01-25 19:10:00 +0000
>>>> 0  swift            0x000000000334ab78 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
>>>> 1  swift            0x0000000003349346 llvm::sys::RunSignalHandlers() + 54
>>>> 2  swift            0x000000000334b6aa
>>>> 3  libpthread.so.0  0x00007fec92166890
>>>> 4  libswiftCore.so  0x00007fec8e8f0735
>>>> 5  libFoundation.so 0x00007fec8c0ab6ee
>>>> 6  libFoundation.so 0x00007fec8bd7a222
>>>> 7  libFoundation.so 0x00007fec8bd7c623
>>>> 8  libFoundation.so 0x00007fec8bf0e873 _TFC10Foundation6NSDateg11descriptionSS + 99
>>>> 9  libFoundation.so 0x00007fec8c182829 _TTWV10Foundation4Dates23CustomStringConvertibleS_FS1_g11descriptionSS + 57
>>>> 10 libswiftCore.so  0x00007fec8e78c745 _TFs15_print_unlockedu0_R_s16TextOutputStreamrFTxRq__T_ + 997
>>>> 
>>>> using swift 3.0.1. Am I doing something wrong? I seems to work on macOS.
>>>> 
>>>> cheers,
>>>> :-Dennis
>>> 
>>> _______________________________________________
>>> swift-corelibs-dev mailing list
>>> swift-corelibs-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
> 


More information about the swift-corelibs-dev mailing list