SR-6422 Encountering "Constant strings cannot be deallocated" in Linux foundation
Issue Description:
I have a block of code throwing this fatal error, that seems to require a larger setup to occur.
importFoundationfuncdefault_components(bucket: String, key: String?=nil, query_items: [URLQueryItem] = []) -> URLComponents {
var components =URLComponents()
components.scheme="https"
components.host="endpoint"
components.path= key ==nil?"/\(bucket)":"/\(bucket)/\(key!)"
components.queryItems= query_items
return components
}
funclist_objects(inbucket: String, prefix: String="", marker: String="", delimiter: String="", max_keys: Int=1000) -> URLRequest {
var components =default_components(bucket: bucket)
components.queryItems?.append(URLQueryItem(name: "prefix", value: prefix))
components.queryItems?.append(URLQueryItem(name: "max-keys", value: String(max_keys))) // I think this is the line that crashes. But reducing further than this somehow eliminates the crash
components.queryItems?.append(URLQueryItem(name: "marker", value: marker))
components.queryItems?.append(URLQueryItem(name: "delimiter", value: delimiter))
let headers: [String: String] = [
"Date":"\(Date())",
]
var request =URLRequest(url: components.url!, timeoutInterval: 60)
request.httpMethod="GET"for (key, value) in headers {
request.addValue(value, forHTTPHeaderField: key)
}
return request
}
list_objects(
in: "bucket",
marker: ""
)
Something about the `components.queryItems?.append(URLQueryItem(name: "max-keys", value: String(max_keys)))` part is causing this to trip, but I can't isolate it further than this. But the above block seems to reproduce reliably for me.
swift-ci commentedNov 15, 2017
Environment
Linux w/ Swift 4
Additional Detail from JIRA
md5: 8f4158106464e25abf1dd3e4e488841a
is duplicated by:
Issue Description:
I have a block of code throwing this fatal error, that seems to require a larger setup to occur.
Something about the `components.queryItems?.append(URLQueryItem(name: "max-keys", value: String(max_keys)))` part is causing this to trip, but I can't isolate it further than this. But the above block seems to reproduce reliably for me.
The text was updated successfully, but these errors were encountered: