Opened 10 years ago

Last modified 10 years ago

#2650 closed defect

Atlas crash on OSX Mavericks — at Version 8

Reported by: wraitii Owned by:
Priority: Must Have Milestone: Alpha 17
Component: Atlas editor Keywords: osx atlas
Cc: Patch:

Description (last modified by wraitii)

Atlas compiles successfully but crashes on startup (either from in-game or the command line). The error given is fairly weird in my case: [NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x103808b10

Update: I've done a lot of step-by-step debugging and in the end I think the culprit are the "[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x102f22d70" errors I get.

I've tried de-threading the Scenario editor to see what the error was, and was still unable to get a window. This is because we never call the wxApp "OnInit" when starting the scenarioEditor. However ActorEditor does, and starts successfully. I've debugged this step by step, and it turns out the culprit is code at line 367 or utils.mm in src/osx/cocoa/, which was added in http://trac.wxwidgets.org/changeset/75142 after reports that non-bundled apps did not work anymore. Somehow, it fails with the above error, whereas actor editor doesn't. FYI, changing ActorEditor project to start ScenarioEditor does run OnInit, though that doesn't work since it lacks a few things. Still working on this.

Change History (13)

comment:1 by wraitii, 10 years ago

Description: modified (diff)

comment:2 by historic_bruno, 10 years ago

Need a call stack or something, OS X actually generates pretty good reports on most crashes, I don't know if they work as well in Atlas. There's always a chance that it's another bug in wxWidgets, or something that changed in their init process from 2.9 to 3.0.

by wraitii, 10 years ago

Attachment: callstack1.rtf added

by wraitii, 10 years ago

Attachment: callstack2.rtf added

comment:3 by wraitii, 10 years ago

Attached two. They are not 100% similar.

Xcode reports the crash in a slightly different place. I also get "segmentation fault: 11" in Terminal.

comment:4 by Philip Taylor, 10 years ago

From those callstacks:

Thread 4 Crashed:
0   pyrogenesis                   	0x0000000107dcd8a1 ReloadChangedFiles() + 81 (Profiler2.h:154)
1   pyrogenesis                   	0x0000000107f0ae99 RunEngine(void*) + 1097 (Singleton.h:65)
2   libsystem_pthread.dylib       	0x00007fff8d99f899 _pthread_body + 138
3   libsystem_pthread.dylib       	0x00007fff8d99f72a _pthread_start + 137
4   libsystem_pthread.dylib       	0x00007fff8d9a3fc9 thread_start + 13
Thread 8 Crashed:
0   pyrogenesis                   	0x000000010a1298a1 ReloadChangedFiles() + 81 (Profiler2.h:154)
1   pyrogenesis                   	0x000000010a266e99 RunEngine(void*) + 1097 (Singleton.h:65)
2   libsystem_pthread.dylib       	0x00007fff8d99f899 _pthread_body + 138
3   libsystem_pthread.dylib       	0x00007fff8d99f72a _pthread_start + 137
4   libsystem_pthread.dylib       	0x00007fff8d9a3fc9 thread_start + 13

I initially guessed the new thread just wasn't calling g_Profiler2.RegisterCurrentThread (so CProfiler2::GetThreadStorage returned NULL), but it looks like it is :-( . Can you test if PROFILE2 works when called immediately after that? and if so, try to work out at what point it stops working, in case something is inexplicably resetting the TLS data. (But I don't see how that can happen.)

by wraitii, 10 years ago

Attachment: call stack.txt added

by wraitii, 10 years ago

Attachment: xcode callstac.png added

comment:5 by wraitii, 10 years ago

Okay, so the two earlier call stacks are useless, I had commented out "g_Profiler2.RegisterCurrentThread" and forgot to revert. I've provided the new one.

The behavior is hanging for a really long while with the [NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x102f22d70 error, and crashing thereafter. Attached callstack.

I've also attached xCode's debugging when the crash happens.

by wraitii, 10 years ago

Attachment: crashlog2.txt added

comment:6 by wraitii, 10 years ago

added Another one that's more information-full, we get a crash when trying to create the CmdLineArgs object, something about n > max_size() throwing an error. It seems to me the cast goes wrong somehow.

It doesn't always happen that way though, which is odd.

comment:7 by wraitii, 10 years ago

After commenting the command line argument stuffs (which weren't needed) and some other code. I get EXC_BAD_INSTRUCTION with code EXC_I386_INVOP in random parts of that loop, unless I comment out the whole inner loop (starting with the while around l170).

It appears however I have no g_renderer nor any g_gui or similar.

If I try to run with -editor, it crashes with this:

[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x7fcd50506a40
2014-07-06 22:36:41.045 pyrogenesis[12401:507] -[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x7fcd50506a40
2014-07-06 22:36 pyrogenesis[12401] (CarbonCore.framework) FSEventStreamCreate: _FSEventStreamCreate: ERROR: could not allocate 0 bytes for array of path strings
2014-07-06 22:36 pyrogenesis[12401] (CarbonCore.framework) FSEventStreamScheduleWithRunLoop(): failed assertion 'streamRef != NULL'

2014-07-06 22:36 pyrogenesis[12401] (CarbonCore.framework) FSEventStreamStart(): failed assertion 'streamRef != NULL'

dir_watch.cpp(143): Assertion failed: "0 && (L"event_loop FSEventStreamStart failed!")"
22:36:41: Error: Assertion failed: "0 && (L"event_loop FSEventStreamStart failed!")"
Location: dir_watch.cpp:143 (CreateEventStream)

Call stack:

(error while dumping stack: Function not supported)
errno = 0 (No error reported here) }}}
Last edited 10 years ago by wraitii (previous) (diff)

comment:8 by wraitii, 10 years ago

Description: modified (diff)

Update: I've done a lot of step-by-step debugging and in the end I think the culprit are the "[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x102f22d70" errors I get.

I've tried de-threading the Scenario editor to see what the error was, and was still unable to get a window. This is because we never call the wxApp "OnInit" when starting the scenarioEditor. However ActorEditor does, and starts successfully. I've debugged this step by step, and it turns out the culprit is code at line 367 or utils.mm in src/osx/cocoa/, which was added in http://trac.wxwidgets.org/changeset/75142 after reports that non-bundled apps did not work anymore. Somehow, it fails with the above error, whereas actor editor doesn't. FYI, changing ActorEditor project to start ScenarioEditor does run OnInit, though that doesn't work since it lacks a few things. Still working on this.

Note: See TracTickets for help on using tickets.