Xcode Sanitizers and Runtime Issues

RSS for tag

Xcode Runtime Issues are reports of programming errors found at run time. Issues can be found by variety of tools, including Address Sanitizer (ASan), Main Thread Checker (MTC), Thread Sanitizer (TSan), and Undefined Behavior Sanitizer (UBSan).

Xcode Runtime Issues Documentation

Posts under Xcode Sanitizers and Runtime Issues tag

28 Posts
Sort by:
Post not yet marked as solved
2 Replies
3.6k Views
Hi, I have a project written in Swift 4 and the following pods are being used in the project: 'GoogleAnalytics' 'GoogleMaps' 'GooglePlaces' 'CarbonKit' 'Firebase/Core' 'Firebase/Messaging' 'Fabric' 'Crashlytics' 'JGProgressHUD' "QBImagePickerController" "YoutubePlayer-in-WKWebView", "~> 0.3.0" 'TrustKit' 'SwiftDate', '~> 5.0' When I am trying to build the same code in XCode version 11.3.1 (11C505), it’s working fine.  But the same code when I am running in XCode version 12.4 (12D4e), it’s showing the following error:  PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/pradip.deore/Library/Developer/Xcode/DerivedData/Re-DeploymentApp-cckdvghmcfgjmdgatkuburgwfion/Build/Intermediates.noindex/Re-Deployment\ App.build/Debug-iphonesimulator/Re-Deployment\ App.build/Script-CE61236C3D7447A8846EA69E.sh (in target 'Re-Deployment App' from project 'Re-Deployment App')   cd /Users/pradip.deore/Projects/iOSemployer   /bin/sh -c /Users/pradip.deore/Library/Developer/Xcode/DerivedData/Re-DeploymentApp-cckdvghmcfgjmdgatkuburgwfion/Build/Intermediates.noindex/Re-Deployment\\\ App.build/Debug-iphonesimulator/Re-Deployment\\\ App.build/Script-CE61236C3D7447A8846EA69E.sh mkdir -p /Users/pradip.deore/Library/Developer/Xcode/DerivedData/Re-DeploymentApp-cckdvghmcfgjmdgatkuburgwfion/Build/Products/Debug-iphonesimulator/ClikSource.app/Frameworks rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/pradip.deore/Library/Developer/Xcode/DerivedData/Re-DeploymentApp-cckdvghmcfgjmdgatkuburgwfion/Build/Products/Debug-iphonesimulator/CarbonKit/CarbonKit.framework" "/Users/pradip.deore/Library/Developer/Xcode/DerivedData/Re-DeploymentApp-cckdvghmcfgjmdgatkuburgwfion/Build/Products/Debug-iphonesimulator/ClikSource.app/Frameworks" building file list ... done sent 205 bytes received 20 bytes 450.00 bytes/sec total size is 188599 speedup is 838.22 /Users/pradip.deore/Projects/iOS_employer/Pods/Target Support Files/Pods-Re-Deployment App/Pods-Re-Deployment App-frameworks.sh: line 131: ARCHS[@]: unbound variable Command PhaseScriptExecution failed with a nonzero exit code I am unable to find a solution for this. Please help to resolve this issue. 
Posted
by
Post not yet marked as solved
3 Replies
4.0k Views
I am working on a library, a Swift package. We have quite a few properties on various classes that can change and we think the @Published property wrapper is a good way to annotate these properties as it offers a built-in way to work with SwiftUI and also Combine. Many of our properties can change on background threads and we've noticed that we get a purple runtime issue when setting the value from a background thread. This is a bit problematic for us because the state did change on a background thread and we need to update it at that time. If we dispatch it to the main queue and update it on the next iteration, then our property state doesn't match what the user expects. Say they "load" or "start" something asynchronously, and that finishes, the status should report "loaded" or "started", but that's not the case if we dispatch it to the main queue because that property doesn't update until the next iteration of the run loop. There also isn't any information in the documentation for @Published that suggests that you must update it on the main thread. I understand why SwiftUI wants it on the main thread, but this property wrapper is in the Combine framework. Also it seems like SwiftUI internally could ask to receive the published updates on the main queue and @Published shouldn't enforce a specific thread. One thing we are thinking about doing is writing our own property wrapper, but that doesn't seem to be ideal for SwiftUI integration and it's one more property wrapper that users of our package would need to be educated about. Any thoughts on direction? Is there anyway to break @Published from the main thread?
Posted
by
Post not yet marked as solved
4 Replies
2.3k Views
Hi, I am working on the apple pie project trying to figure out why this line of code is outputting an error. all of my connections are correct and I have double checked them and the game file is correct as well. how can I remove this error and continue the project? [
Posted
by
Post not yet marked as solved
1 Replies
1.7k Views
Hi! I am trying to build a Flutter project, but I keep getting this message : Target Support Files/GoogleUserMessagingPlatform/GoogleUserMessagingPlatform-xcframeworks.sh: Permission denied Command PhaseScriptExecution failed with a nonzero exit code I tried pod init / pod install / etc. but I get messages there like _ [!] No Xcode project found, please specify one _
Posted
by
Post marked as solved
3 Replies
1.3k Views
I'm writing here because I'm out of ideas now, I allow my iOS app to be used on macOS and previously I was able to launch my app via XCode and perform debugging but suddenly I'm not able to launch my app anymore (I updated my OS (12.6) and my XCode (14.0.1) in the meantime). When I start it I see the icon but then it immediately crashes with following error in the output AddressSanitizer: CHECK failed: sanitizer_mac.cpp:1231 "((ret_value)) <= (((1ULL << 36)))" ... AddressSanitizer: CHECK failed: sanitizer_mac.cpp:1231 "((ret_value)) <= (((1ULL << 36)))" ... (lldb)  I can't even put a breakpoint anywhere as my code doesn't even get executed. I tried a test project and it works there but my project doesn't start up even though it works perfectly fine on iOS/ tvOS and on iPads. How can I fix this error or what's exactly the problem?
Posted
by
Post not yet marked as solved
6 Replies
3.8k Views
Hello team can you please help me to resolve this issue Executable Path is a Directory Domain: DVTMachOErrorDomain Code: 5 Recovery Suggestion: /Users/macdevelopername/Library/Developer/Xcode/DerivedData/gopapp-aidgtlievbwsjgdfdydbgdajgjgw/Build/Products/Debug-iphonesimulator/gopapp.app is not a valid path to an executable file. User Info: {   DVTErrorCreationDateKey = "2022-11-09 06:23:30 +0000"; } -- System Information macOS Version 12.5 (Build 21G72) Xcode 14.1 (21534.1) (Build 14B47b) Timestamp: 2022-11-09T11:53:30+05:30
Posted
by
Post not yet marked as solved
2 Replies
1.5k Views
I am using Xcode 14.3 and when Issue that says "Could not find bundle inside /Library/Developer/CommandLineTools under scntool". I searched this up and tried reinstalling CommandLineTools, reinstalling xcode, and reseting xcode. Here are screenshots of the issue: https://docs.google.com/document/d/1H6HsoZoJhISMo-5cXG-kN0hat6jftcujL1iYK2TRkeA/edit And here is the code: https://github.com/EnderRobber101/Xcode Is there a solution? Please inform me of the solution. Thank you for reading.
Posted
by
Post not yet marked as solved
1 Replies
1.2k Views
I'm working on a weather and news app, and when I run the app on my device, it says "This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and checking authorizationStatus first." I am getting the error, what should I do? This error message appears on two lines with the CLLocationManager.locationServicesEnabled() else { method. I have added the codes of the page where I got the error below. I am using openweathermap API as weather API and newsapi API as news API. import Foundation import CoreLocation import Combine typealias LocationNameResultType = Result<String, Error> class WeatherService: WeatherServiceProtocol { private let apiProvider = APIProvider<WeatherEndpoint>() private let locationManager = CLLocationManager() private lazy var location: CLLocation? = locationManager.location init() { startUpdatingLocation() } func getCityName(completion: @escaping (LocationNameResultType) -> Void) { guard let location = location else { completion(.failure(WeatherServiceErrors.locationNil)) return } let geocoder = CLGeocoder() geocoder.reverseGeocodeLocation(location) { (placemarks, error) in if let error = error { completion(.failure(error)) } guard let placemark = placemarks?.first, let cityName = placemark.locality else { completion(.failure(WeatherServiceErrors.placeMarkNil)) return } completion(.success(cityName)) } } func requestCurrentWeather() -> AnyPublisher<Data, Error> { locationManager.requestWhenInUseAuthorization() guard CLLocationManager.locationServicesEnabled() else { return Fail(error: WeatherServiceErrors.userDeniedWhenInUseAuthorization) .eraseToAnyPublisher() } locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters locationManager.startUpdatingLocation() guard let location = location else { return Fail(error: WeatherServiceErrors.locationNil) .eraseToAnyPublisher() } return apiProvider.getData( from: .getCurrentWeather(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude) ) .eraseToAnyPublisher() } deinit { stopUpdatingLocation() } } private extension WeatherService { func startUpdatingLocation() { locationManager.requestWhenInUseAuthorization() guard CLLocationManager.locationServicesEnabled() else { return } locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters locationManager.startUpdatingLocation() } func stopUpdatingLocation() { locationManager.stopUpdatingLocation() } }
Posted
by
Post not yet marked as solved
3 Replies
2.2k Views
Hi! I am getting the next warning returned when the textfield is focused. Xcode version: 14.3.1. Should I ignore it ? 2023-09-06 20:55:04.483056+0200 Delete1[6598:29619] [Query] Error for >queryMetaDataSync: 2 2023-09-06 20:55:04.487287+0200 Delete1[6598:29619] [Query] Error for >queryMetaDataSync: 2 2023-09-06 20:55:04.974905+0200 Delete1[6598:30000] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000026e3f60> F8BB1C28-BAE8-11D6-9C31-00039315CD46 import SwiftUI struct ContentView: View { @State private var username: String = "" @FocusState private var usernameInFocus: Bool var body: some View { VStack { TextField("Addd", text: $username) .focused($usernameInFocus) .padding(.leading) .frame(height:55) .frame(maxWidth: .infinity) .background(Color.gray.brightness(0.3)) .cornerRadius(10) Button("toggle"){ usernameInFocus.toggle() } } .padding(44) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Posted
by
Post marked as solved
5 Replies
988 Views
Dear Experts, When I try to use Address Sanitizer on my iOS app, it reports "attempting free on address which was not malloc()-ed" whenever a C++ exception is caught. If first saw it inside Apple's libFontParser and filed FB13271831, but I now see it in my own code. The Address Sanitizer stack trace always starts like this: #1 0x215766ae8 in __cxa_decrement_exception_refcount+0x40 (/usr/lib/libc++abi.dylib:arm64e+0x13ae8) Having looked up __cxa_decrement_exception_refcount in the C++ ABI docs, my guess is that the C++ runtime is creating and destroying the exception objects in some way that Address Sanitizer doesn't properly understand, causing it to think that they are being freed without having been allocated by malloc. This is only really a problem because it does not seem possible to continue after ASan has reported this error; the app is terminated. Question: is there a way to tell Address Sanitiser to ignore errors in this function? And/or, is there a way to continue after the error? Thanks.
Posted
by
Post not yet marked as solved
8 Replies
717 Views
I'm having a hard time relying on TSAN to detect problems due to its rightful insistence on reporting data-races (I know, stick with me). Picture the following implementation of a lazily-allocated property in an Obj-C class: @interface MyClass { id _myLazyValue; // starts as nil as all other Obj-C ivars } @end @implementation MyClass - (id)myLazyValue { if (_myLazyValue == nil) { @synchronized(self) { if (_myLazyValue == nil) { _myLazyValue = &lt;expensive computation&gt; } } } return _myLazyValue; } @end The first line in the method is reading a pointer-sized chunk of memory outside of the protection provided by the @synchronized(...) statement. That same value may be written by a different thread within the execution of the @synchronized block. This is what TSAN complains about, but I need it not to. The code above ensures the ivar is written by at most one thread. The read is unguarded, but it is impossible for any thread to read a non-nil value back that is invalid, uninitialized or unretained. Why go through this trouble? Such a lazily-allocated property usually locks on @synchronized once, until (at most) one thread does any work. Other threads may be temporarily waiting on the same lock but again only while the value is being initialized. The cost of allocation and initialization is guaranteed to be paid once: multiple threads cannot initialize the value multiple times (that’s the reason for the second _myLazyValue == nil check within the scope of the @synchronized block). Subsequent accesses of the initialized property skip locking altogether, which is exactly the performance we want from a lazily-allocated, immutable property that still guarantees thread-safe access. Assuming there isn't a big embarrassing hole in my logic, is there a way to decorate specific portions of our sources (akin to #pragma statements that disable certain warnings) so that you can mark any read/write access to a specific value as "safe"? Is the most granular tool for this purpose the __attribute__((no_sanitize("thread")))? Ideally one would want to ask TSAN to ignore only specific read/writes, rather than the entire body of a function. Thank you!
Posted
by
Post not yet marked as solved
1 Replies
1.6k Views
Hi! I noticed that when I use the simple Textfield in SwiftUI it generates unexpected error: -[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID Error: this application, or a library it uses, has passed an invalid numeric value (NaN, or not-a-number) to CoreGraphics API and this value is being ignored. Please fix this problem. If you want to see the backtrace, please set CG_NUMERICS_SHOW_BACKTRACE environmental variable. Here is the code example to repoduce the error: import SwiftUI struct ContentView: View { @State private var firstName = "" var body: some View { TextField("First name", text: $firstName) } } How it could be fixed ? Is it one of the bugs that came along with iOS 17 ? Thank you!
Posted
by
Post not yet marked as solved
2 Replies
521 Views
I didn't find any errors in my program, and Xcode didn't report any errors in the program code, but when I ran it, it inexplicably reported an error: Command CompileAssetCatalog failed with a nonzero exit code What should I do?
Posted
by
Post not yet marked as solved
0 Replies
428 Views
Hello, I'm trying to build XNU with KASAN support. However I get error: clang: error: unsupported option '-fsanitize=kernel-hwaddress' for target 'arm64e-apple-darwin23.2.0' If I try to compile a non-kernel C code with -fsanitize=hwaddress, I get the same target error. But Apple ships HWASan kernels with KDK, which shows there is a clang which is capable of compiling hwasan code for arm64e. How can we compile hwasan sanitized code ourselves? Is it a private toolchain or released somewhere?
Posted
by
Post marked as solved
2 Replies
570 Views
I was making the cancel button of the memo screen in my iOS memo application. But, when I clicked the cancel button, Thread 1: EXC_BREAKPOINT (code=1, subcode=0x18855e560) error appeared. I used dismiss(animate: true, completion: nil) code ComposeViewController Code import UIKit class ComposeViewController: UIViewController { @IBAction func close(_ sender: Any) { dismiss(animated: true, completion: nil). //this code was problem } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } //something more that is comment code '//' }
Posted
by
Post not yet marked as solved
1 Replies
435 Views
Hello everyone, good day. For months now, I have been trying to get the iOS 17 simulator on my MacBook Pro. Unfortunately, it failed during the installation process. When it reached 100%, it showed 'installing,' but, regrettably, it failed and displayed the following error: (-67061 invalid signature (code or signature have been modified) Domain: SimDiskImageErrorDomain Code: 5 User Info: { DVTErrorCreationDateKey = "2024-02-02 13:57:23 +0000"; unusableErrorDetail = ""; } Has anyone ever come across this error? I would appreciate it if anyone could shed light on what it means and provide guidance on how to bypass it before attempting the installation again.
Posted
by
Post not yet marked as solved
2 Replies
537 Views
Hello everyone, good day. For months now, I have been trying to get the iOS 17 simulator on my MacBook Pro. Unfortunately, it failed during the installation process. When it reached 100%, it showed 'installing,' but, regrettably, it failed and displayed the following error: (-67061 invalid signature (code or signature have been modified) Domain: SimDiskImageErrorDomain Code: 5 User Info: { DVTErrorCreationDateKey = "2024-02-02 13:57:23 +0000"; unusableErrorDetail = ""; } Has anyone ever come across this error? I would appreciate it if anyone could shed light on what it means and provide guidance on how to bypass it before attempting the installation again.
Posted
by