File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
# 10.2.0
2
- - [ fixed] Fix a race condition where a download size could exceed the value of the ` maxSize ` parameter. (#10358 )
2
+ - [ fixed] Fixed an issue where using Storage with more than one FirebaseApp instance caused non-default Storage instances to deadlock (#10463 ).
3
+ - [ fixed] Fixed a race condition where a download size could exceed the value of the ` maxSize ` parameter. (#10358 )
3
4
4
5
# 10.1.0
5
6
- [ fixed] Fixed a 10.0.0 regression where metadata passed to ` putFile ` was not properly initialized. (#10353 )
Original file line number Diff line number Diff line change @@ -302,6 +302,7 @@ import FirebaseAuthInterop
302
302
}
303
303
304
304
/// Map of apps to a dictionary of buckets to GTMSessionFetcherService.
305
+ private static let fetcherServiceLock = NSObject ( )
305
306
private static var fetcherServiceMap : [ String : [ String : GTMSessionFetcherService ] ] = [ : ]
306
307
private static var retryWhenOffline : GTMSessionFetcherRetryBlock = {
307
308
( suggestedWillRetry: Bool ,
@@ -321,8 +322,8 @@ import FirebaseAuthInterop
321
322
_ auth: AuthInterop ,
322
323
_ appCheck: AppCheckInterop )
323
324
-> GTMSessionFetcherService {
324
- objc_sync_enter ( fetcherServiceMap )
325
- defer { objc_sync_exit ( fetcherServiceMap ) }
325
+ objc_sync_enter ( fetcherServiceLock )
326
+ defer { objc_sync_exit ( fetcherServiceLock ) }
326
327
var bucketMap = fetcherServiceMap [ app. name]
327
328
if bucketMap == nil {
328
329
bucketMap = [ : ]
Original file line number Diff line number Diff line change @@ -137,6 +137,24 @@ class StorageResultTests: StorageIntegrationCommon {
137
137
waitForExpectations ( )
138
138
}
139
139
140
+ func testNoDeadlocks( ) throws {
141
+ let storage2 = Storage . storage ( url: " " )
142
+
143
+ let expectation1 = expectation ( description: #function)
144
+ let expectation2 = expectation ( description: #function)
145
+ let ref = storage. reference ( withPath: " ios/public/testBytesUpload " )
146
+ let data = try XCTUnwrap ( " Hello Swift World " . data ( using: . utf8) , " Data construction failed " )
147
+ ref. putData ( data) { result in
148
+ expectation1. fulfill ( )
149
+
150
+ let ref2 = storage2. reference ( withPath: " ios/public/testBytesUpload " )
151
+ ref2. putData ( data) { result in
152
+ expectation2. fulfill ( )
153
+ }
154
+ }
155
+ waitForExpectations ( timeout: 30 )
156
+ }
157
+
140
158
func testSimplePutSpecialCharacter( ) throws {
141
159
let expectation = self . expectation ( description: #function)
142
160
let ref = storage. reference ( withPath: " ios/public/-._~!$'()*,=:@&+; " )
You can’t perform that action at this time.
0 commit comments