Peculiar behaviour with Mac OS X Application on El Capitan

I have an installation made with Packages (v1.1.3), and my (codesigned) application installs fine.

And I can run it ONCE. Second time, the application won't open. It is as if OS X thinks the application still is running, because if I start the application from terminal open -n /Applications/MyApplication.app it DOES open. But not without the -n option. And there is no instance of it running, either shown in Activity Monitor, or with ps -A.

Doing open /Applications/MyApplication.app in Terminal, the open command will just "hang" indefinitely. No log entries in Console, nor any on stdout that could shed light on this.

Starting the executable directly in a terminal: /Applications/MyApplication.app/Contents/MacOS/MyApplication works just fine though (!)

And one more thing: If I rename the app to say, "MyApplication2.app", it ALSO opens up correctly. But not if I change it back.

When in this condition (which is fully reproducable by uninstalling the package, then reinstall it), if I logout, then log back in, the application will open normally.

Furthermore: The application works fine on a freshly installed El Capitan (and on Yosemite), the problem has thus far arisen on machines that have upgraded from Yosemite to El Capitan.

I really have no idea where to look for the solution for this one...

Edit 1: Actually, this is reproduced each time I reboot the Mac. But if I then logout/login, it starts working. This is not acceptable!

Edit 2: Spindump from when open is in the "hung" condition:

Date/Time:       2015-12-14 10:46:25 +0100
OS Version:      Mac OS X 10.11.1 (Build 15B42)
Architecture:    x86_64
Report Version:  22

Command:         open
Path:            /usr/bin/open
Version:         ??? (???)
Parent:          bash [421]
Responsible:     Terminal [253]
PID:             435

Duration:        10.00s
Steps:           1000 (10ms sampling interval)

Hardware model:  MacBookPro6,2
Active cpus:     4

Fan speed:       1996 rpm

------------------------------------------------------------
Heavy format: stacks are sorted by count
Use -i and -timeline to re-report with chronological sorting
------------------------------------------------------------



Process:         open [435]
Path:            /usr/bin/open
Architecture:    x86_64
Parent:          bash [421]
Responsible:     Terminal [253]
UID:             501
Task size:       2140 pages (-6)
Note:            2 idle work queue threads omitted

  Thread 0x1223           DispatchQueue 1         1000 samples (1-1000)   priority 31 (base 31)
  1000  start + 1 (libdyld.dylib + 13741) [0x7fff9ce485ad]
    1000  ??? (open + 13012) [0x1075572d4]
      1000  LSOpenURLsWithRole + 32 (LaunchServices + 191296) [0x7fff9c263b40]
        1000  _LSOpenURLsWithRole_Common(__CFArray const*, unsigned int, AEKeyDesc const*, LSApplicationParameters_V1 const*, ProcessSerialNumber*, long, __CFURL const**) + 387 (LaunchServices + 627634) [0x7fff9c2ce3b2]
          1000  _LSOpenStuff + 126 (LaunchServices + 156284) [0x7fff9c25b27c]
            1000  _LSOpenStuffCallLocal + 5692 (LaunchServices + 199633) [0x7fff9c265bd1]
              1000  CFDictionaryApplyFunction + 186 (CoreFoundation + 277482) [0x7fff984e6bea]
                1000  CFBasicHashApply + 128 (CoreFoundation + 277680) [0x7fff984e6cb0]
                  1000  __CFDictionaryApplyFunction_block_invoke + 22 (CoreFoundation + 277750) [0x7fff984e6cf6]
                    1000  _LSOpenItemsWithHandler_CFDictionaryApplier(void const*, void const*, void*) + 5103 (LaunchServices + 206768) [0x7fff9c2677b0]
                      1000  _LSOpenApp(LSOpenState*, unsigned int, FSNode*, unsigned int, unsigned char*, ProcessSerialNumber*) + 338 (LaunchServices + 208695) [0x7fff9c267f37]
                        1000  _LSLaunch(LSContext*, FSNode*, unsigned int, void*, __CFArray const*, AEDesc const*, __CFArray const*, __CFDictionary const*, unsigned int, audit_token_t const*, ProcessSerialNumber*, unsigned char*) + 8437 (LaunchServices + 218379) [0x7fff9c26a50b]
                          1000  _LSLaunchApplication + 5837 (LaunchServices + 228056) [0x7fff9c26cad8]
                            1000  LaunchApplicationViaLaunchDJobLabel(LSSessionID, CFMutableDictionary&, CFMutableDictionary&, __CFArray const*, char const* const*, __LSASN const**, __CFDictionary const**) + 1683 (LaunchServices + 235258) [0x7fff9c26e6fa]
                              1000  _spawn_via_launchd + 801 (libxpc.dylib + 80457) [0x7fff8e287a49]
                                1000  _xpc_interface_routine + 163 (libxpc.dylib + 24054) [0x7fff8e279df6]
                                  1000  xpc_pipe_routine + 249 (libxpc.dylib + 24411) [0x7fff8e279f5b]
                                    1000  mach_msg_trap + 10 (libsystem_kernel.dylib + 72854) [0x7fff95636c96]
                                     *1000  ipc_mqueue_receive_continue + 0 (kernel + 856352) [0xffffff80002d1120]

  Thread 0x1224           DispatchQueue 2         1000 samples (1-1000)   priority 31 (base 31)
  1000  _dispatch_mgr_thread + 52 (libdispatch.dylib + 32133) [0x7fff8d35bd85]
    1000  kevent_qos + 10 (libsystem_kernel.dylib + 98466) [0x7fff9563d0a2]
     *1000  ??? (kernel + 5844400) [0xffffff8000792db0]

Report the Bug

Given the behaviour is reproducible and your spindump output suggests the hang occurs within Apple's LSOpenURLsWithRole, report a bug with Apple.

Sadly, your bug is unlikely to attract any immediate attention from Apple.

Demand Help from Apple's DTS

As this is likely a blocking bug, open a Technical Support Incident (TSI) with Apple's Developer Technical Support (DTS). Your Apple Developer membership includes two incidents and this situation is an ideal candidate for these incidents:

Requesting Technical Support

A Technical Support Incident (TSI) is a request for code-level support for Apple frameworks, APIs, and tools, and is available to members of the Apple Developer Program, Apple Developer Enterprise Program, and MFi Program. Submit a TSI if you cannot fix a bug, have trouble implementing a specific technology, or have other questions about your code. Your incident will be assigned to a Developer Technical Support engineer who can help troubleshoot your code or provide workarounds to fast-track your development. Responses are delivered via email in English, typically within three business days.

Apple Developer Program and Apple Developer Enterprise Program

Included with each enrollment are two Technical Support Incidents, which will expire at the end of your membership year. …