Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"nextEventMatchingMask should only be called from the Main Thread!" #2

Closed
halflings opened this issue Aug 9, 2017 · 8 comments
Closed

Comments

@halflings
Copy link

On Mac OS (Sierra, 10.12.5), on a MacBook Pro (15-inch, 2016)

python -m pysc2.bin.agent --map Simple64

Crashes with the following output:

NSWindowEdgeResizing is off!
2017-08-09 21:06:05.039 Python[2686:52867] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/xw/ch07jry12bn15s2bhs2wlvr40000gn/T/org.python.python.savedState
2017-08-09 21:06:05.648 Python[2686:52867] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'nextEventMatchingMask should only be called from the Main Thread!'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8de062cb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fffa2c1148d objc_exception_throw + 48
    2   AppKit                              0x00007fff8bff2e82 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 4480
    3   libSDL-1.2.0.dylib                  0x0000000107cb99dc QZ_PumpEvents + 358
    4   libSDL-1.2.0.dylib                  0x0000000107c99866 SDL_PumpEvents + 35
    5   libSDL-1.2.0.dylib                  0x0000000107c99a44 SDL_EventState + 197
    6   libSDL-1.2.0.dylib                  0x0000000107cb82dd SDL_JoystickEventState + 41
    7   joystick.so                         0x0000000107f51db2 joy_autoinit + 50
    8   Python                              0x000000010629a921 PyObject_Call + 99
    9   Python                              0x000000010631de37 PyEval_CallObjectWithKeywords + 165
    10  base.so                             0x0000000107c89c6c init + 268
    11  Python                              0x000000010631a884 PyEval_EvalFrameEx + 26960
    12  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    13  Python                              0x00000001062b8c73 function_call + 350
    14  Python                              0x000000010629a921 PyObject_Call + 99
    15  Python                              0x000000010631aed8 PyEval_EvalFrameEx + 28580
    16  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    17  Python                              0x00000001062b8c73 function_call + 350
    18  Python                              0x000000010629a921 PyObject_Call + 99
    19  Python                              0x000000010631aed8 PyEval_EvalFrameEx + 28580
    20  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    21  Python                              0x000000010631e45e fast_function + 117
    22  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    23  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    24  Python                              0x000000010631e45e fast_function + 117
    25  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    26  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    27  Python                              0x00000001062b8c73 function_call + 350
    28  Python                              0x000000010629a921 PyObject_Call + 99
    29  Python                              0x00000001062a5685 instancemethod_call + 173
    30  Python                              0x000000010629a921 PyObject_Call + 99
    31  Python                              0x00000001062e1d50 slot_tp_init + 64
    32  Python                              0x00000001062defb9 type_call + 182
    33  Python                              0x000000010629a921 PyObject_Call + 99
    34  Python                              0x000000010631a6bc PyEval_EvalFrameEx + 26504
    35  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    36  Python                              0x00000001062b8c73 function_call + 350
    37  Python                              0x000000010629a921 PyObject_Call + 99
    38  Python                              0x000000010631aed8 PyEval_EvalFrameEx + 28580
    39  Python                              0x000000010631e4f1 fast_function + 264
    40  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    41  Python                              0x000000010631e4f1 fast_function + 264
    42  Python                              0x000000010631a78f PyEval_EvalFrameEx + 26715
    43  Python                              0x0000000106313d3e PyEval_EvalCodeEx + 1617
    44  Python                              0x00000001062b8c73 function_call + 350
    45  Python                              0x000000010629a921 PyObject_Call + 99
    46  Python                              0x00000001062a5685 instancemethod_call + 173
    47  Python                              0x000000010629a921 PyObject_Call + 99
    48  Python                              0x000000010631de37 PyEval_CallObjectWithKeywords + 165
    49  Python                              0x000000010634a63a t_bootstrap + 70
    50  libsystem_pthread.dylib             0x00007fffa370f93b _pthread_body + 180
    51  libsystem_pthread.dylib             0x00007fffa370f887 _pthread_body + 0
    52  libsystem_pthread.dylib             0x00007fffa370f08d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    2686 abort      python -m pysc2.bin.agent --map Simple64
@halflings
Copy link
Author

Since the error seems to be related to a PyGame call, I have pygame==1.9.3

@Stexan
Copy link

Stexan commented Aug 10, 2017

I have the exact same problem, pygame is also 1.9.3

@TueChristensen
Copy link

Same problem for me on similar mac and os.

@americodias
Copy link

Same here. macOS 10.12.6 with Python 2.7.13 and Python 3.6.2

@tomekowal
Copy link
Contributor

tomekowal commented Aug 10, 2017

It looks like on OSX OpenCV allows rendering only in main thread. I made a change suggested by error message and moved rendering to main thread. That made it run for me here: https://github.com/tomekowal/pysc2
You can clone the repo and as long as you are pysc2 directory examples should work. I am not sure how would it affect linux and windows, so I am hesitant to submit a proper PR. If anyone is going to seriously work on the issue, this commit might be a good start.

@Aizee
Copy link

Aizee commented Aug 11, 2017

Thanks @tomekowal that fixed it for me. Anybody else trying this make sure to 'pip uninstall pysc2' first before you install the fix

@americodias
Copy link

tomekowal it worked for me too. Thanks

@tewalds
Copy link
Contributor

tewalds commented Aug 11, 2017

Fixed in 509f607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants