OSX and Matlab 2019b issue

I realise this is going to be a very low priority issue, however I thought I might as well report it. To save others a headache.


All PTB demos I have tried abort under OSX 10.14.6, Matlab 2019b. 


Here is the output for one demo (it is the same error with any demo I have tried)


>> DriftDemo


PTB-INFO: This is Psychtoolbox-3 for Apple OS X, under Matlab 64-Bit (Version 3.0.16 - Build date: Aug  5 2019).

PTB-INFO: OS support status: OSX version 10.14 is not officially supported or tested at all for this release.

PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.

PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with

PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.


INTERNAL PSYCHTOOLBOX ERROR

error:                PsychError_InvalidWindowRecord

general description:  An Invalid window record was referenced.

module name:          Screen

subfunction call:     WindowKind

file name:            /Users/kleinerm/projects/OpenGLPsychtoolbox/Psychtoolbox-3/PsychSourceGL/Source/Common/Screen/WindowHelpers.c

function name:        PsychCheckIfWindowRecordIsValid

line number:          61

Error using Screen

See error message printed above.


Error in sca (line 22)

    if Screen('WindowKind', win) == 1


Error in DriftDemo (line 138)

    sca;



The same demos work fine under OSX 10.14.6, Matlab 2019a on the same machine (MBP Late 2016). So it seems Matlab 2019b is what is triggering things. 


I have not had the chance to try PTB + Matlab 2019b on Windows or Linux, as we have largely transitioned away from PTB and Matlab, so do not have immediate access to these setups. I could probably test under Windows next week sometime if that is of any help. 


No need for the usual snarky "upgrade" to Linux replies etc, etc, etc. These are very well rehearsed by now. 



1 Like
I have used 2019b with Linux and Windows, and I didn't see these error messages BTW.
It's yet another bug in Apples trainwreck, this time related to GUI
operations and multi-threading. One of two new impressively dumb bugs
i found, apart from the even worse display timing bug, because not
only all good things come in three. I think it was introduced a couple
of trainwreck releases ago, but had more minor effects, e.g., that
when onscreen windows get closed then often the screen gets stuck, not
switching back to the GUI again, unless one does random mouse
clicking. At some recent point, Apple redefined this design defect
into a "feature" iow. they documented the new and backwards
incompatible rules wrt. GUI and multi-threading, because why behave
like a half-way responsible operating system vendor just because you
make an operating system?

While the bug is clearly in macOS and fully Apples fault, it needs
specific multi-threading design patterns in the host application to
trigger and express the bug in all its glory. That's why the same
macOS bug shows different symptoms with different runtime
environments.

The problem got much worse with 10.14 Mojave, but so far it only
really badly affected GNU/Octave, which basically abort's immediately
if you try to open an onscreen window on Mojave, while working fine on
older macOS releases. Matlab up to R2019a got away by dumb luck, where
only closing the onscreen window got completely stuck - a problem we
counteract by opening a figure window needlessly at each session,
because for whatever reason that fixed the "stuck window" problem on
Mojave, see https://github.com/Psychtoolbox-3/Psychtoolbox-3/blob/master/Psychtoolbox/PsychJava/PsychJavaSwingCleanup.m#L27
for our madness to counteract the iToys companies madness.

With Ian's and Peter's results on R2019b it seems the luck of Matlab
users has run out, and whatever Mathworks changed internally now
triggers the same crash sequence on 10.14+ as previously only on
Octave. Luckily Octave aborted with some bunch of useful error
messages, whereas Matlab somehow just silently fails and aborts
'Openwindow' in the middle of C-Code execution, probably due to
differences in exception handling, and the PTB script continues
running with damaged internal data structures, leading to that totally
bogus error message about invalid window records in
Screen('Windowkind').

Anyway, i do have - quite horrifying and shaky - workarounds for the
two new Mojave bugs, and Ian's testing on the GitHub issue already
shows they seem to work with R2019b. However, these workarounds are
part of some contract work, so it depends on the specifics of how that
contract goes if and when these fixes get released.

-mario


On Fri, Sep 27, 2019 at 11:48 PM iandol@... [PSYCHTOOLBOX]
<PSYCHTOOLBOX@yahoogroups.com> wrote:
>
>
>
> Hm, I have a github issue open on the same error message, which I thought was caused by the fact I'm using macOS Catalina public beta:
>
>
> https://github.com/kleinerm/Psychtoolbox-3/issues/156
>
> But yes, I'm also using 2019b, and so it seems my error is not an OS problem but a MATLAB one. Not sure what could be causing this, but I can confirm the same error messages.
>
> Ian
>
>