New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 733810 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

DCHECK in -[CrXPCMachPort encodeWithCoder:] on 10.13 at launch

Project Member Reported by mark@chromium.org, Jun 15 2017

Issue description

I did a debug build on 10.13db1 17A264c. I was using Xcode 9b1 9M136h and the 10.13 SDK, although I’m not sure that this matters.

The resulting app hits a DCHECK soon after launch.

[mmdd/hhmmss.µµµµµµ:WARNING:mac_util.mm(421)] Assuming Darwin 17 is Mac OS X 10.13
[mmdd/hhmmss.µµµµµµ:WARNING:allocator_interception_mac.mm(453)] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
[mmdd/hhmmss.µµµµµµ:WARNING:mac_util.mm(421)] Assuming Darwin 17 is Mac OS X 10.13
[mmdd/hhmmss.µµµµµµ:WARNING:allocator_interception_mac.mm(453)] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
[pid:tid:mmdd/hhmmss.µµµµµµ:FATAL:xpc_mach_port.mm(65)] Check failed: [coder isKindOfClass:NSClassFromString(@"NSXPCEncoder")]. 
0   libbase.dylib                       0x000000010648c7ae base::debug::StackTrace::StackTrace(unsigned long) + 174
1   libbase.dylib                       0x000000010648c84d base::debug::StackTrace::StackTrace(unsigned long) + 29
2   libbase.dylib                       0x000000010648aacc base::debug::StackTrace::StackTrace() + 28
3   libbase.dylib                       0x000000010652aa9f logging::LogMessage::~LogMessage() + 479
4   libbase.dylib                       0x0000000106528415 logging::LogMessage::~LogMessage() + 21
5   libchrome_dll.dylib                 0x0000000115874781 -[CrXPCMachPort encodeWithCoder:] + 289
[…]

The DCHECK being hit is https://chromium.googlesource.com/chromium/src/+/25df70294a0c70bb8b39a30ea69ef0be072c4097/chrome/browser/ui/cocoa/notifications/xpc_mach_port.mm#65.

The NSXPCEncoder that we’re expecting is something else now, NSXPCEncoder_Legacy. They have a common ancestor class, NSXPCCoder, but neither of the two flavors of NSXPCEncoder directly inherits from the other. Look at the class hierarchy at the bottom of the debug session.

In the debugger:

litterbox@litterbox zsh% lldb out/debug/Chromium.app/Contents/MacOS/Chromium
(lldb) target create "out/debug/Chromium.app/Contents/MacOS/Chromium"
Current executable set to 'out/debug/Chromium.app/Contents/MacOS/Chromium' (x86_64).
(lldb) run
Process pid launched: '/Volumes/HFSPlus/chrome/chrome/src/out/debug/Chromium.app/Contents/MacOS/Chromium' (x86_64)
[mmdd/hhmmss.µµµµµµ:WARNING:mac_util.mm(421)] Assuming Darwin 17 is Mac OS X 10.13
[mmdd/hhmmss.µµµµµµ:WARNING:allocator_interception_mac.mm(453)] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
[pid:tid:mmdd/hhmmss.µµµµµµ:FATAL:xpc_mach_port.mm(65)] Check failed: [coder isKindOfClass:NSClassFromString(@"NSXPCEncoder")]. 
Process pid stopped
* thread #1, name = 'CrBrowserMain', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x0000000117ea9944 libbase.dylib`base::debug::BreakDebugger() at debugger_posix.cc:269
   266 	  // Terminate the program after signaling the debug break.
   267 	  _exit(1);
   268 	#endif
-> 269 	}
   270 	
   271 	}  // namespace debug
   272 	}  // namespace base
Target 0: (Chromium) stopped.
[…]
(lldb) bt
* thread #1, name = 'CrBrowserMain', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
  * frame #0: 0x0000000117ea9944 libbase.dylib`base::debug::BreakDebugger() at debugger_posix.cc:269
    frame #1: 0x0000000117f4aaf8 libbase.dylib`logging::LogMessage::~LogMessage(this=0x00007fff5fbf7cb0) at logging.cc:783
    frame #2: 0x0000000117f47415 libbase.dylib`logging::LogMessage::~LogMessage(this=0x00007fff5fbf7cb0) at logging.cc:546
    frame #3: 0x0000000109ecc781 libchrome_dll.dylib`::-[CrXPCMachPort encodeWithCoder:](self=0x0000000100188c10, _cmd="encodeWithCoder:", coder=0x0000000100189390) at xpc_mach_port.mm:65
    frame #4: 0x00007fffc3d00818 Foundation`-[NSXPCEncoder_Legacy _encodeObject:] + 605
    frame #5: 0x00007fffc3b1cdfb Foundation`encodeInvocationArguments + 331
    frame #6: 0x00007fffc3d002c1 Foundation`-[NSXPCEncoder_Legacy encodeInvocation:] + 340
    frame #7: 0x00007fffc3d00818 Foundation`-[NSXPCEncoder_Legacy _encodeObject:] + 605
    frame #8: 0x00007fffc3dd4385 Foundation`-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 3265
    frame #9: 0x00007fffc3dd3446 Foundation`-[NSXPCConnection _sendSelector:withProxy:arg1:] + 100
    frame #10: 0x00007fffc3de253c Foundation`_NSXPCDistantObjectSimpleMessageSend1 + 43
    frame #11: 0x0000000103f68a75 libchrome_dll.dylib`::-[AlertDispatcherImpl serviceProxy](self=0x0000000100185e60, _cmd="serviceProxy") at notification_platform_bridge_mac.mm:599
    frame #12: 0x0000000103f678d8 libchrome_dll.dylib`::-[AlertDispatcherImpl getDisplayedAlertsForProfileId:incognito:notificationCenter:callback:](self=0x0000000100185e60, _cmd="getDisplayedAlertsForProfileId:incognito:notificationCenter:callback:", profileId="Default", incognito=NO, notificationCenter=0x0000000100188580, callback=<unavailable>) at notification_platform_bridge_mac.mm:575
    frame #13: 0x0000000103f65932 libchrome_dll.dylib`NotificationPlatformBridgeMac::GetDisplayed(this=0x00000001001880f0, profile_id="Default", incognito=false, callback=0x00007fff5fbf8a80), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) const at notification_platform_bridge_mac.mm:338
    frame #14: 0x0000000103f49a54 libchrome_dll.dylib`NativeNotificationDisplayService::GetDisplayed(this=0x0000000100188930, callback=0x00007fff5fbf8a80), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) at native_notification_display_service.cc:116
    frame #15: 0x0000000103f77cd2 libchrome_dll.dylib`PlatformNotificationServiceImpl::GetDisplayedNotifications(this=0x0000000100185b30, browser_context=0x0000000144b6df60, callback=0x00007fff5fbf8a80), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) at platform_notification_service_impl.cc:407
    frame #16: 0x000000011f7ddc00 libcontent.dylib`content::PlatformNotificationContextImpl::Initialize(this=0x0000000100185310) at platform_notification_context_impl.cc:69
    frame #17: 0x000000011fee1de2 libcontent.dylib`content::StoragePartitionImpl::Create(context=0x0000000144b6df60, in_memory=false, relative_partition_path=0x00007fff5fbfa9e8) at storage_partition_impl.cc:517
    frame #18: 0x000000011fefbb42 libcontent.dylib`content::StoragePartitionImplMap::Get(this=0x00000001001818c0, partition_domain="", partition_name="", in_memory=false) at storage_partition_impl_map.cc:397
    frame #19: 0x000000011ec6a56f libcontent.dylib`content::(anonymous namespace)::GetStoragePartitionFromConfig(browser_context=0x0000000144b6df60, partition_domain="", partition_name="", in_memory=false) at browser_context.cc:128
    frame #20: 0x000000011ec6a4bd libcontent.dylib`content::BrowserContext::GetStoragePartition(browser_context=0x0000000144b6df60, site_instance=0x0000000000000000) at browser_context.cc:271
    frame #21: 0x000000011ec6a859 libcontent.dylib`content::BrowserContext::GetDefaultStoragePartition(browser_context=0x0000000144b6df60) at browser_context.cc:304
    frame #22: 0x00000001041fbc82 libchrome_dll.dylib`ProfileImpl::DoFinalInit(this=0x0000000144b6df60) at profile_impl.cc:683
    frame #23: 0x00000001041fff5b libchrome_dll.dylib`ProfileImpl::OnLocaleReady(this=0x0000000144b6df60) at profile_impl.cc:918
    frame #24: 0x00000001041fa8f7 libchrome_dll.dylib`ProfileImpl::OnPrefsLoaded(this=0x0000000144b6df60, create_mode=CREATE_MODE_SYNCHRONOUS, success=true) at profile_impl.cc:948
    frame #25: 0x00000001041f9f3e libchrome_dll.dylib`ProfileImpl::ProfileImpl(this=0x0000000144b6df60, path=0x00007fff5fbfd010, delegate=0x0000000000000000, create_mode=CREATE_MODE_SYNCHRONOUS, sequenced_task_runner=0x0000000144b6dce0) at profile_impl.cc:550
    frame #26: 0x00000001041f6503 libchrome_dll.dylib`ProfileImpl::ProfileImpl(this=0x0000000144b6df60, path=0x00007fff5fbfd010, delegate=0x0000000000000000, create_mode=CREATE_MODE_SYNCHRONOUS, sequenced_task_runner=0x0000000144b6dce0) at profile_impl.cc:432
    frame #27: 0x00000001041f5c2b libchrome_dll.dylib`Profile::CreateProfile(path=0x00007fff5fbfd010, delegate=0x0000000000000000, create_mode=CREATE_MODE_SYNCHRONOUS) at profile_impl.cc:336
    frame #28: 0x0000000104287c65 libchrome_dll.dylib`ProfileManager::CreateProfileHelper(this=0x0000000100387e00, path=0x00007fff5fbfd010) at profile_manager.cc:1303
    frame #29: 0x000000010427838b libchrome_dll.dylib`ProfileManager::CreateAndInitializeProfile(this=0x0000000100387e00, profile_dir=0x00007fff5fbfd010) at profile_manager.cc:1380
    frame #30: 0x0000000104277e45 libchrome_dll.dylib`ProfileManager::GetProfile(this=0x0000000100387e00, profile_dir=0x00007fff5fbfd010) at profile_manager.cc:505
    frame #31: 0x00000001090d77e6 libchrome_dll.dylib`GetStartupProfile(user_data_dir=0x0000000100120ab0, command_line=0x0000000100109990) at startup_browser_creator.cc:963
    frame #32: 0x0000000103b52507 libchrome_dll.dylib`(anonymous namespace)::CreatePrimaryProfile(parameters=0x0000000100120998, user_data_dir=0x0000000100120ab0, parsed_command_line=0x0000000100109990) at chrome_browser_main.cc:442
    frame #33: 0x0000000103b4ff73 libchrome_dll.dylib`ChromeBrowserMainParts::PreMainMessageLoopRunImpl(this=0x0000000100120990) at chrome_browser_main.cc:1609
    frame #34: 0x0000000103b4f36d libchrome_dll.dylib`ChromeBrowserMainParts::PreMainMessageLoopRun(this=0x0000000100120990) at chrome_browser_main.cc:1245
    frame #35: 0x000000011ec86090 libcontent.dylib`content::BrowserMainLoop::PreMainMessageLoopRun(this=0x000000010011d470) at browser_main_loop.cc:1109
    frame #36: 0x000000011ec8cf8d libcontent.dylib`int base::internal::FunctorTraits<int (content::BrowserMainLoop::*)(), void>::Invoke<content::BrowserMainLoop*>(method=40 5f c8 1e 01 00 00 00 00 00 00 00 00 00 00 00, receiver_ptr=0x00007fff5fbfdf30)(), content::BrowserMainLoop*&&) at bind_internal.h:209
    frame #37: 0x000000011ec8ced4 libcontent.dylib`int base::internal::InvokeHelper<false, int>::MakeItSo<int (functor=0x000000010033f5f8, args=0x00007fff5fbfdf30)(), content::BrowserMainLoop*>(int (content::BrowserMainLoop::* const&&&)(), content::BrowserMainLoop*&&) at bind_internal.h:275
    frame #38: 0x000000011ec8ce63 libcontent.dylib`int base::internal::Invoker<base::internal::BindState<int (content::BrowserMainLoop::*)(), base::internal::UnretainedWrapper<content::BrowserMainLoop> >, int ()>::RunImpl<int (functor=0x000000010033f5f8, bound=0x000000010033f608, (null)=IndexSequence<0> @ 0x00007fff5fbfdf08)(), std::__1::tuple<base::internal::UnretainedWrapper<content::BrowserMainLoop> > const&, 0ul>(int (content::BrowserMainLoop::* const&&&)(), std::__1::tuple<base::internal::UnretainedWrapper<content::BrowserMainLoop> > const&&&, base::IndexSequence<0ul>) at bind_internal.h:351
    frame #39: 0x000000011ec8cd6c libcontent.dylib`base::internal::Invoker<base::internal::BindState<int (content::BrowserMainLoop::*)(), base::internal::UnretainedWrapper<content::BrowserMainLoop> >, int ()>::Run(base=0x000000010033f5d0) at bind_internal.h:329
    frame #40: 0x000000011fe8f58d libcontent.dylib`base::Callback<int (), (base::internal::CopyMode)1, (base::internal::RepeatMode)1>::Run(this=0x0000000100320dc0) const at callback.h:80
    frame #41: 0x000000011fedf0e0 libcontent.dylib`content::StartupTaskRunner::RunAllTasksNow(this=0x000000010033f4e0) at startup_task_runner.cc:45
    frame #42: 0x000000011ec82284 libcontent.dylib`content::BrowserMainLoop::CreateStartupTasks(this=0x000000010011d470) at browser_main_loop.cc:930
    frame #43: 0x000000011ec9106f libcontent.dylib`content::BrowserMainRunnerImpl::Initialize(this=0x000000010011bbb0, parameters=0x00007fff5fbfeda0) at browser_main_runner.cc:127
    frame #44: 0x000000011ec7aa8d libcontent.dylib`content::BrowserMain(parameters=0x00007fff5fbfeda0) at browser_main.cc:42
    frame #45: 0x0000000121170005 libcontent.dylib`content::RunNamedProcessTypeMain(process_type="", main_function_params=0x00007fff5fbfeda0, delegate=0x00007fff5fbff7a8) at content_main_runner.cc:411
    frame #46: 0x0000000121171ad2 libcontent.dylib`content::ContentMainRunnerImpl::Run(this=0x00000001001099e0) at content_main_runner.cc:704
    frame #47: 0x000000012116e61d libcontent.dylib`content::ContentServiceManagerMainDelegate::RunEmbedderProcess(this=0x00007fff5fbff6f0) at content_service_manager_main_delegate.cc:41
    frame #48: 0x00000001179f3284 libembedder.dylib`service_manager::Main(params=0x00007fff5fbff6d8) at main.cc:469
    frame #49: 0x000000012116fd79 libcontent.dylib`content::ContentMain(params=0x00007fff5fbff780) at content_main.cc:19
    frame #50: 0x00000001020061ce libchrome_dll.dylib`::ChromeMain(argc=1, argv=0x00007fff5fbff920) at chrome_main.cc:121
    frame #51: 0x0000000100000de6 Chromium`main(argc=1, argv=0x00007fff5fbff920) at chrome_exe_main_mac.cc:170
    frame #52: 0x00007fffe8a5c515 libdyld.dylib`start + 1
(lldb) frame select 3
frame #3: 0x0000000109ecc781 libchrome_dll.dylib`::-[CrXPCMachPort encodeWithCoder:](self=0x0000000100188c10, _cmd="encodeWithCoder:", coder=0x0000000100189390) at xpc_mach_port.mm:65
   62  	}
   63  	
   64  	- (void)encodeWithCoder:(NSCoder*)coder {
-> 65  	  DCHECK([coder isKindOfClass:NSClassFromString(@"NSXPCEncoder")]);
   66  	  DCHECK(port_.is_valid());
   67  	
   68  	  id coderAsId = coder;
(lldb) print coder
(NSXPCEncoder_Legacy *) $0 = 0x0000000100189390
(lldb) print (NSString*)NSStringFromClass([coder class])
(__NSCFString *) $1 = 0x000000014ce7a9b0 @"NSXPCEncoder_Legacy"
(lldb) print (NSString*)NSStringFromClass([coder superclass])
(__NSCFString *) $2 = 0x0000000100189c40 @"NSXPCCoder"
(lldb) print (NSString*)NSStringFromClass([[coder superclass] superclass])
(NSTaggedPointerString *) $3 = 0x7265646f43534e75 @"NSCoder"
(lldb) print (NSString*)NSStringFromClass([[[coder superclass] superclass] superclass])
(NSTaggedPointerString *) $4 = 0x00894a6058038485 @"NSObject"
(lldb) print (NSString*)NSStringFromClass([NSXPCEncoder class])
(__NSCFString *) $5 = 0x000000014ce7ab50 @"NSXPCEncoder"
(lldb) print (NSString*)NSStringFromClass([NSXPCEncoder superclass])
(__NSCFString *) $6 = 0x000000010026aa80 @"NSXPCCoder"
 

Comment 1 by tapted@chromium.org, Jun 16 2017

Components: UI>Notifications
Labels: -Pri-3 Pri-2
Owner: rsesek@chromium.org
Status: Assigned (was: Untriaged)
[mac triage] assigning based on git blame

Comment 2 by shrike@chromium.org, Jul 12 2017

Cc: shrike@chromium.org
Labels: -Pri-2 M-61 Pri-1
Hello rsesek@,

Would you please assess the seriousness of this bug? From looking at the code I'm guessing that as long as the NSXPCEncoder_Legacy responds to -encodeXPCObject:forKey: we're OK, at least for now? It seems like it must (and perhaps this class was kept around just for Chrome) because even though the DCHECK fails, the non-debug build of Chrome does not crash on launch.

Do we confirm that everything is still working as expected by making sure native notifications still work?

Comment 3 by rsesek@chromium.org, Jul 13 2017

This is not a serious bug and AlertNotificationService.xpc does work on 10.13. I will fix the DCHECK after investigating.

Comment 4 by rsesek@chromium.org, Jul 13 2017

Labels: -Pri-1 Pri-2

Comment 5 by mark@chromium.org, Jul 31 2017

Status: Fixed (was: Assigned)
Not seeing these DCHECKs any more in 10.13db4 17A315i. NSXPCEncoder_legacy and NSXPCDecoder_legacy are gone entirely. These objects are NSXPCEncoder and NSXPCDecoder again, meeting the DCHECKs’ expectations.

I don’t know if they replaced the “legacy” versions with new ones, or if they got rid of the new ones and decided to stick with the old, but it shouldn’t matter from our perspective.

Comment 6 by shrike@chromium.org, Jul 31 2017

Should we be planning on getting away from NSXPCEncoder_Legacy? 

Comment 7 by rsesek@chromium.org, Jul 31 2017

This is all internal to foundation. We're not explicitly using anything "legacy".

Comment 8 by rsesek@chromium.org, Aug 25 2017

Cc: spqc...@chromium.org erikc...@chromium.org
 Issue 759094  has been merged into this issue.

Sign in to add a comment