Skip to content

PortMidi.open(:output, name) makes :observer.start() not work on Mac OS #12

@geolessel

Description

@geolessel

If I have a brand new mix project and add portmidi as a dependency, everything is fine up to this point. I can run :observer.start() in an IEx session without any issue.

However, as soon as I run PortMidi.open(:output, output_device), I can no longer run :observer.start() and IEx crashes. The error output is below.

Do you have any idea why?

I'm running Elixir 1.8.0 on Erlang 21 on Mac OS.

Error output (I've attempted to clean up various white space oddities):

> iex -S mix
Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Interactive Elixir (1.8.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> PortMidi.open(:output, Enum.at(PortMidi.devices().output, 0).name)
{:ok, #PID<0.185.0>}
iex(2)> :observer.start()
2019-01-22 18:00:40.042 beam.smp[93854:3670893] !!! BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.
2019-01-22 18:00:40.046 beam.smp[93854:3670893] pid(93854)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!

### The above is repeated many times

2019-01-22 18:00:40.089 beam.smp[93854:3670893] *** Assertion failure in void assertRunningOnAppKitThread(void)(), /BuildRoot/Library/Caches/com.apple.xbs/Sources/ViewBridge/ViewBridge-401.1/ViewBridgeUtilities.m:912
2019-01-22 18:00:40.095 beam.smp[93854:3670893] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'not running on AppKit (main) thread'

*** First throw call stack: (
0   CoreFoundation                      0x00007fff36f1cecd __exceptionPreprocess + 256
1   libobjc.A.dylib                     0x00007fff62fd8720 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff36f37b2a +[NSException raise:format:arguments:] + 98
3   Foundation                          0x00007fff3932aeed -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4   ViewBridge                          0x00007fff600978ea __26+[NSRemoteView initialize]_block_invoke + 15
5   libdispatch.dylib                   0x00007fff64057d53 _dispatch_call_block_and_release + 12
6   libdispatch.dylib                   0x00007fff64058dcf _dispatch_client_callout + 8
7   libdispatch.dylib                   0x00007fff64063f63 _dispatch_main_queue_callback_4CF + 1125
8[1]    93854 abort      iex -S mix

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions