I'm at my wit's end trying to figure out a "silent" crash I am getting. There isn't a specific part of code where it occurs, because I have placed nslogs in several locations and there is no correlation with them and the crash.
I am using vmtracker in the instruments allocation tool and my dirty memory varies but crashes as low as 32 MB. My live bytes in allocations (not vmtracker) is stable at around 10-12 MB.
I could understand it if it was some logic error, but this is a silent crash and xcode gives no information except NSZombie_NSException.
This is from the crash log:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x60000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x34da9564 0x34da6000 + 13668
1 libobjc.A.dylib 0x34da9f84 0x34da6000 + 16260
2 libobjc.A.dylib 0x34dab1d2 0x34da6000 + 20946
3 CoreFoundation 0x372ae600 0x371ec000 + 796160
4 CoreFoundation 0x372ae358 0x371ec000 + 795480
5 libobjc.A.dylib 0x34daea62 0x34da6000 + 35426
6 libc++abi.dylib 0x35a41078 0x35a40000 + 4216
7 libc++abi.dylib 0x35a41110 0x35a40000 + 4368
8 libc++abi.dylib 0x35a42594 0x35a40000 + 9620
9 libobjc.A.dylib 0x34dae9cc 0x34da6000 + 35276
10 CoreFoundation 0x371f4f1c 0x371ec000 + 36636
11 CoreFoundation 0x371f4d44 0x371ec000 + 36164
12 GraphicsServices 0x34eaa2e6 0x34ea5000 + 21222
13 UIKit 0x36c6c2fc 0x36c15000 + 357116
14 Pocket Dungeons 0x0008a2be 0x3a000 + 328382
15 Pocket Dungeons 0x0003b8bc 0x3a000 + 6332
Is 32 MB a lot of dirty memory for iPod Touch 4g, iOS 6?
Related
I've just updated to Xcode 14, I compile my code with the -mcmodel=large flag.
This used to work on Xcode 13, but since the upgrade I get the following error:
0 0x104a141a0 __assert_rtn + 140
1 0x104a1d2ec ld::tool::SymbolTableAtom<arm64>::classicOrdinalForProxy(ld::Atom const*) (.cold.2) + 0
2 0x104925598 ld::tool::LocalRelocationsAtom<arm64_32>::~LocalRelocationsAtom() + 0
3 0x104924ab8 ld::tool::SymbolTableAtom<arm64>::addImport(ld::Atom const*, ld::tool::StringPoolAtom*) + 204
4 0x104924150 ld::tool::SymbolTableAtom<arm64>::encode() + 420
5 0x104910c18 ___ZN2ld4tool10OutputFile20buildLINKEDITContentERNS_8InternalE_block_invoke_3 + 36
6 0x1ac8465f0 _dispatch_call_block_and_release + 32
7 0x1ac8481b4 _dispatch_client_callout + 20
8 0x1ac859b14 _dispatch_root_queue_drain + 952
9 0x1ac85a104 _dispatch_worker_thread2 + 164
10 0x1aca08324 _pthread_wqthread + 228
A linker snapshot was created at:
/tmp/project_name-2022-09-18-183942.ld-snapshot
ld: Assertion failed: (dylib != NULL), function classicOrdinalForProxy, file LinkEditClassic.hpp, line 495.
Removing -mcmodel=large solves the issue, but I need this flag for my code.
Does -fno-objc-msgsend-selector-stubs help?
Since I added translations between two ContentViews (to go from one to the other one nicely), I have the following logs:
This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
Stack:(
0 Foundation 0x0000000110da2ec6 _AssertAutolayoutOnAllowedThreadsOnly + 77
1 Foundation 0x0000000110da2b89 -[NSISEngine _optimizeWithoutRebuilding] + 61
2 Foundation 0x0000000110bb1ebb -[NSISEngine optimize] + 108
3 Foundation 0x0000000110da00ac -[NSISEngine performPendingChangeNotifications] + 84
4 UIKit 0x00000001116f89f9 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2211
5 QuartzCore 0x00000001138a63ee -[CALayer layoutSublayers] + 153
6 QuartzCore 0x00000001138aa4dd _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
7 QuartzCore 0x0000000113832ded _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 365
8 QuartzCore 0x000000011385e704 _ZN2CA11Transaction6commitEv + 500
9 MyProject.iOS 0x000000010f6bbd39 xamarin_dyn_objc_msgSend + 217
10 ??? 0x000000012f8e9462 0x0 + 5092840546
11 ??? 0x000000013025827c 0x0 + 5102731900
12 MyProject.iOS 0x000000010f5272c9 mono_jit_runtime_invoke + 1273
13 MyProject.iOS 0x000000010f5dbaa8 do_runtime_invoke + 88
14 MyProject.iOS 0x000000010f61bf9e start_wrapper + 718
15 libsystem_pthread.dylib 0x0000000117fe06c1 _pthread_body + 340
16 libsystem_pthread.dylib 0x0000000117fe056d _pthread_body + 0
17 libsystem_pthread.dylib 0x0000000117fdfc5d thread_start + 13
)
This is my code:
Device.BeginInvokeOnMainThread(async () =>
{
DetailContentView.Children.Insert(0, masterDetailContentView);
await DetailContentView.Children[1].TranslateTo(App.ScreenWidth - 100, 0, 250);
await DetailContentView.Children[1].TranslateTo(App.ScreenWidth, 0, 50);
DetailContentView.Children.RemoveAt(1);
});
where DetailContentView is a Grid, masterDetailContentView is the ContentView that will appear and DetailContentView.Children[1] is the ContentView that will disappear.
This piece of code works but I want to remove the logs.
Thanks!
One of my projects (containing over 200 files in pure Swift) has just recently started interfering with the indexing process. The indexing process freezes midway and then stops abruptly, causing SourceKitService to crash.
I simply cannot find the faulty code; because there appears to be none!
My code compiles just fine (without a single warning!) - and yet it fails to be indexed. Initially, I thought it to be an Xcode 7.2 issue and so upgraded to the latest beta (7.3); however the issue still persists. I cannot revert back to my old code because too much work will be undone, and I can't spot a particular file to blame. The crash report is here.
To clarify, Xcode itself does not crash, only the indexing process (and SourceKitService as a consequence).
Any ideas on how to go about fixing this?
Remove "xcuserdata" from .xcodeproj (right click on .xcodeproj > select Show Package Contents. This should solve the problem.
If I'm reading properly,
the problem comes from this part of the process:
Thread 8 Crashed:
0 com.apple.SourceKitService 0x000000010450d9fc swift::TypeBase::getDesugaredType() + 12
1 com.apple.SourceKitService 0x00000001043bccbe (anonymous namespace)::DeclChecker::checkDynamicSelfReturn(swift::FuncDecl*, swift::TypeRepr*, unsigned int) + 478
2 com.apple.SourceKitService 0x00000001043b7c08 (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) + 1432
3 com.apple.SourceKitService 0x00000001043acc0d (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2733
4 com.apple.SourceKitService 0x00000001043a7ea7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 727
5 com.apple.SourceKitService 0x00000001043b6426 (anonymous namespace)::DeclChecker::visitSubscriptDecl(swift::SubscriptDecl*) + 1478
6 com.apple.SourceKitService 0x00000001043acbdd (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2685
7 com.apple.SourceKitService 0x00000001043a7ea7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 727
8 com.apple.SourceKitService 0x00000001044fc003 swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3075
9 com.apple.SourceKitService 0x00000001043c7a7c swift::TypeChecker::lookupMember(swift::DeclContext*, swift::Type, swift::DeclName, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 556
10 com.apple.SourceKitService 0x00000001043d51b7 (anonymous namespace)::ConformanceChecker::lookupValueWitnesses(swift::ValueDecl*, bool*) + 359
11 com.apple.SourceKitService 0x00000001043d11a1 (anonymous namespace)::ConformanceChecker::resolveWitnessViaLookup(swift::ValueDecl*) + 401
12 com.apple.SourceKitService 0x00000001043ce86f swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2255
13 com.apple.SourceKitService 0x000000010438011b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 1099
14 com.apple.SourceKitService 0x00000001043809e5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1781
15 com.apple.SourceKitService 0x0000000103fa40c2 swift::CompilerInstance::performSema() + 4738
16 com.apple.SourceKitService 0x0000000103e9a836 SourceKit::SwiftLangSupport::indexSource(llvm::StringRef, SourceKit::IndexingConsumer&, llvm::ArrayRef<char const*>, llvm::StringRef) + 4262
17 com.apple.SourceKitService 0x0000000103eb086a void SourceKit::WorkQueue::DispatchData::callAndDelete<handleRequestImpl(void*, std::__1::function<void (void*)>)::$_2>(void*) + 2170
18 libdispatch.dylib 0x00007fff9b7de33f _dispatch_client_callout + 8
19 libdispatch.dylib 0x00007fff9b7ec03a _dispatch_block_invoke + 474
20 com.apple.SourceKitService 0x00000001056afbbf executeBlock(void*) + 15
21 com.apple.SourceKitService 0x0000000103f3e58d ExecuteOnThread_Dispatch(void*) + 13
22 libsystem_pthread.dylib 0x00007fff8be14c13 _pthread_body + 131
23 libsystem_pthread.dylib 0x00007fff8be14b90 _pthread_start + 168
24 libsystem_pthread.dylib 0x00007fff8be12375 thread_start + 13
which leads us to :
https://github.com/apple/swift/pull/932/files
20days + ago
So I guess it's a known issue.
However I don't know what is causing it. I'm pretty sure it's a swift code style that is not well supported yet.
I also found your crash in this Crash test project:
https://github.com/practicalswift/swift-compiler-crashes
If you look into it, you might find the precise case that triggers one of those crashes:
✓ 28197 swift typebase getdesugaredtype
✓ 28200 swift typebase getdesugaredtype
✓ 28203 swift typebase getdesugaredtype
I am trying to run on Monodevelop (latest Git) a solution that runs fine on Xamarin.Mac
It crashes at the base() line:
public class SetupWindow : NSWindow {
public List <NSButton> Buttons = new List <NSButton> ();
public string Header;
public string Description;
private NSImage side_splash;
private NSImageView side_splash_view;
private NSTextField header_text_field;
private NSTextField description_text_field;
public SetupWindow () : base ()
{
SetFrame (new RectangleF (0, 0, 640, 420), true);
With this output:
2014-02-06 18:05:28.567 mono[8564:507] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1000) creating CGSWindow on line 263'
*** Call stack at first throw:
(
0 CoreFoundation 0x927956b1 __raiseError + 193
1 libobjc.A.dylib 0x96f38091 objc_exception_throw + 162
2 CoreFoundation 0x927955cb +[NSException raise:format:] + 139
3 AppKit 0x97f434b3 _NSCreateWindowWithOpaqueShape2 + 1718
4 AppKit 0x97f41f3a -[NSWindow _commonAwake] + 4391
5 AppKit 0x97e167fb -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 864
6 AppKit 0x97e15de3 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1090
7 AppKit 0x97e1599a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 70
8 AppKit 0x9860919a -[NSWindow init] + 107
9 ??? 0x02a01d22 0x0 + 44047650
10 ??? 0x04095ebc 0x0 + 67722940
11 ??? 0x04095108 0x0 + 67719432
12 ??? 0x02a02c34 0x0 + 44051508
13 ??? 0x029fec8c 0x0 + 44035212
14 ??? 0x02296b84 0x0 + 36268932
15 ??? 0x02296e9f 0x0 + 36269727
16 mono 0x0007b2ee mono_jit_runtime_invoke + 798
17 mono 0x0023500e mono_runtime_invoke + 126
18 mono 0x002395c4 mono_runtime_exec_main + 420
19 mono 0x00239935 mono_runtime_run_main + 725
20 mono 0x000e68d5 mono_jit_exec + 149
21 mono 0x000e8f12 mono_main + 9778
22 mono 0x0006e9fe main + 558
23 mono 0x0006e7c5 start + 53
Any idea what is going wrong?
Because of another problem, I commented out the lines that set images for NSApplication.SharedApplication.ApplicationIconImage and NSWorkspace.SharedWorkspace.SetIconforFile, could that be the problem?
A colleague tried on his brand new Mac, and gets the exact same problem.
The problem was fixed by adding these two lines before instantiating SetupWindow:
NSApplication.SharedApplication.ApplicationIconImage = image;
SetFolderIcon ();
Now the application runs fine.
I'm trying to run this on OSX 10.7:
/**
* simple.d
*/
import std.stdio;
import derelict.sdl.sdl;
import derelict.sdl.macinit.SDLMain;
import derelict.opengl.gl;
pragma(lib, "/usr/local/src/Derelict2/lib/libDerelictUtil.a");
pragma(lib, "/usr/local/src/Derelict2/lib/libDerelictSDL.a");
pragma(lib, "/usr/local/src/Derelict2/lib/libDerelictGL.a");
int main(string[] args) {
// Load Derelict
writeln("Loading SDL...");
DerelictSDL.load();
// Initialise SDL
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) {
throw new Exception("SDL initialization failed");
}
// Enable Double Buffering
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
// Set up the screen
SDL_Surface* screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
if (screen == null) {
throw new Exception("Screen is null");
}
SDL_WM_SetCaption("Simple", "Simple");
// Print OpenGL and GLSL version
writeln("Version Info");
writeln("OpenGL:\t", glGetString(GL_VERSION));
writeln("GLSL:\t", glGetString(GL_SHADING_LANGUAGE_VERSION));
// Execute frame update
SDL_GL_SwapBuffers();
// Quit SDL; SDL_Quit() takes care of freeing the screen surface
writeln("Quitting SDL...");
SDL_Quit();
writeln("Bye!");
return 0;
}
It compiles fine, but when I try to run it I get:
$ ./simple
Loading SDL...
Version Info
Segmentation fault: 11
Here's the thread output:
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff8376282a __kill + 10
1 libsystem_c.dylib 0x00007fff8e965cfa _sigtramp + 26
2 ??? 000000000000000000 0 + 0
3 simple 0x000000010d299db9 D2rt6dmain24mainUiPPaZi7runMainMFZv + 29
4 simple 0x000000010d29976e D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 38
5 simple 0x000000010d299e06 D2rt6dmain24mainUiPPaZi6runAllMFZv + 58
6 simple 0x000000010d29976e D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 38
7 simple 0x000000010d2996f9 main + 237
8 simple 0x000000010d24a554 start + 52
Thread 1 Crashed:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff837637e6 kevent + 10
1 libdispatch.dylib 0x00007fff896b378a _dispatch_mgr_invoke + 923
2 libdispatch.dylib 0x00007fff896b231a _dispatch_mgr_thread + 54
Now if I try to compile both Derelict and simple.d in 32bit mode (-m32) I get this output instead:
$ ./simple
Loading SDL...
Version Info
Bus error: 10
Thread output:
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x93107332 __kill + 10
1 libsystem_kernel.dylib 0x93106932 kill$UNIX2003 + 32
2 libsystem_c.dylib 0x943f175e raise + 26
3 libsystem_c.dylib 0x9447d59b _sigtramp + 43
4 ??? 0xffffffff 0 + 4294967295
5 SDL 0x01bb7108 SDL_Error + 275
6 simple 0x000760ab D2rt6dmain24mainUiPPaZi7runMainMFZv + 23
7 simple 0x00075a6c D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 24
8 simple 0x000760f3 D2rt6dmain24mainUiPPaZi6runAllMFZv + 59
9 simple 0x00075a6c D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv + 24
10 simple 0x00075a0c main + 184
11 simple 0x00035bb5 start + 53
Thread 1 Crashed:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x9310890a kevent + 10
1 libdispatch.dylib 0x96a74e10 _dispatch_mgr_invoke + 969
2 libdispatch.dylib 0x96a7385f _dispatch_mgr_thread + 53
I've tried other gl... functions like glClearColor() and they yield the same results.
You didn't load the gl function pointers.
DerelictGL.load();