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

Startup failure when connecting to StimServer #30

Open
jsdpag opened this issue Jun 9, 2022 · 1 comment
Open

Startup failure when connecting to StimServer #30

jsdpag opened this issue Jun 9, 2022 · 1 comment

Comments

@jsdpag
Copy link
Contributor

jsdpag commented Jun 9, 2022

It is not uncommon for ARCADE's initialisation sequence to crash with something like the following printed to the Command Window:

**************** ARCADE ********************
Launching: runCore
09-Jun-2022 17:18:05
MATLAB version: 9.5.0.944444 (R2018b)
User name: smithj
Computer name: ESI-WSFRI021
ARCADE version: 2.5.7-62-g274453b (git)
**************** ARCADE ********************
Found cfg file: C:\Users\smithj\Documents\MATLAB\reaction.time.detection\template\rt_det_template_cfg.mat
Config file loaded...
Checking for backup files...
Starting Session...
17:19:37 The contents of Homer_20220609_rt_det_template_1 will be deleted
17:19:37 Storing session configuration and associated files in
C:\Toolbox\ARCADE\sessionLog\Homer_20220609_rt_det_template_1
17:19:37 Starting MatlabControlScreen.bat
17:19:37 Starting EyeServer
17:19:38 Starting DaqServer
17:19:38 Waiting for processes to start
17:19:49 Starting StimServer
17:19:50 Connect to StimServer
Error using StimServer.Write (line 192)
Assertion failed.

Error in StimServer.Command (line 198)
StimServer.Write([typecast(uint16(key), 'uint8')
uint8(bytearr)]);

Error in StimServer.GetFrameRate (line 153)
StimServer.Command(0, uint8([1 8]));

Error in launch_processes (line 99)
logmessage(sprintf('FrameRate = %3.0f', StimServer.GetFrameRate));

Error in runCore (line 100)
processes = launch_processes(cfg, ...

I'm not sure that I understand what the root of the problem is. At this point, the StimServer object has already connected to the named pipe without error.

However, the CreateFileA docs say that INVALID_HANDLE_VALUE is returned on error. But the assertion following the call to CreateFileA only checks to see if the returned pointer is NULL.

I'm not sure that we can assume INVALID_HANDLE_VALUE == NULL. It could be anything that the ... open minded developers at MS consider to be sensible.

@jsdpag
Copy link
Contributor Author

jsdpag commented Jun 15, 2022

For unrelated reasons, I was testing visual stimuli in a regular Matlab session. I did so by opening a normal Matlab session, running add_arcade_to_path.m, opening StimServer.exe, and then running StimServer.Connect( ).

A number of times, I needed to run StimServer.Disconnect( ), close StimServer.exe, fiddle with the monitor, then re-open StimServer.exe and run StimServer.Connect( ) again

On some occasions, the very next StimServer command e.g. StimServer.SetBackgroundColor( ) would fail. It turns out that simply re-running StimServer.Disconnect( )/StimServer.Connect( ) would solve the problem. Note, Matlab would remain open.

This is suggestive of a low-level issue with the named pipe. Perhaps Windows leaves some residue that sticks the next time a pipe with the same name is created?

In any case, I will pilot a work-around, in which the launch sequence disconnects/re-connects StimServer several times if GetFrameRate raises an error.

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

1 participant