NSFileManager thread safety
Frederik Seiffert <[email protected]> Mon, 17 Jul 2023 17:46:21 +0200
| Newsgroups | gmane.comp.lib.gnustep.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all, We=E2=80=99re running into what seems to be a concurrency issue (on = Windows) where our app crashes when concurrently calling -[NSData = writeToFile:options:error:] (on separate NSData objects) from multiple = threads. I noticed that the method uses +[NSFileManager defaultManager], which I = think used to not be thread safe on Apple platforms. Before digging into = this deeper, I was wondering if anyone has knowledge about the thread = safety of NSFileManager (or writeToFile) in GNUstep? We can narrow down the crash when we place an autorelease pool = immediately around the call to writeToFile, and the crash happens when = releasing the pool: Fatal Error: EXCEPTION_ACCESS_VIOLATION_READ / 0xffffffffffffffff Thread 4756 Crashed: 0 objc.dll 0x7ff83e6727d0 objc_storeWeak 1 objc.dll 0x7ff83e671c4d objc_autoreleasePoolPop 2 objc.dll 0x7ff83e671bc2 objc_autoreleasePoolPop 3 objc.dll 0x7ff83e67195b objc_autoreleasePoolPop 4 MyApp.exe 0x7ff6e840005a -[MyApp = methodCallingNSDataWriteToFile] Thanks! Frederik