Whitescreen halfway through experiments

URL of experiment: https://run.pavlovia.org/BastiaanTan/extremity_v2

Description of the problem: Hi all, thanks for reading.

So I programmed this experimental procedure. About 80-90% of the time, it works fine. However, sometimes the procedure stops and participants are presented with a white screen. The screen does still respond to mouse inputs (i.e. if I click an invisible button that ends the routine, it ends), but stimuli are not being drawn anymore.

This seems to hold for all stimuli, including components being drawn using custom code components but also text, polygons, images, etc.

The prevalence of this problem was extremely high today (± 1/3 of participants)…

At first I thought it was a server side error, as 5 people were simultaneously running the experiment and 4/5 got the problem at the exact same time although they were in different phases of the experiment and started at various moments.

However, as more people got kicked this got less likely as often only one or two participants got the problem despite up to 12 people running the experiment concurrently.

Then I suspected it might have to do with the machine the experiment is run on. The problem seemed to be mostly when people used relatively old apple computers. This, however, also does not seem to be the single rule that helps predict whether a participant will experience issues.

I thus do not really know where to look now. It seems unlikely to me that there’s a problem with the code I wrote as the first time this went wrong, 4/5 got the problem at exact the same time - it is unlikely they all broke the code by accident at exactly the same time.

I should mention I do have a shelf variable that’s being used to counterbalance conditions. However, I have not yet been able to establish any relation to that being updated and participants being kicked.

I am also running another experiment, for which participants are recruited through Prolific. There 1 out of 33 participants experienced the same problem. This is the link: GoNogo Learning and Preferences [PsychoPy]

Any ideas or suggestions what the problem might be are more than welcome.
Thanks in advance!

Kind regards,
Bastiaan

Does your experiment access the shelf apart from during one counterbalance routine?

I think it does.

The first routine of the experiment contains a code component with the code below. I’d like to direct your attention to the variable “fractalOrder”, which uses “option” which in turn is based on the shelf variable “participantNumber”.
fractalOrder is later called again later. I assume that there the shelf gets accessed again because of this chain of reference. Second part of the code is pasted below the first


// increase the value on the shelf by 1
psychoJS.shelf.addIntegerValue({key: [‘participantNumber’], delta: 1})
// fetch the current value on the shelf (this variable is displayed in text)
participantNumber = await psychoJS.shelf.getIntegerValue({key: [‘participantNumber’], defaultVlaue: 0})

// Using the Shelf for Multi-session testing, Counterbalancing and more online — PsychoPy v2024.2.4

option = participantNumber % 6
console.log(option, learningOrderOptions)
fractalOrder = fractalOrderOptions[option]
learningOrder = learningOrderOptions[option] //select the appropriate order for this participant.
cycle = 0 //keep track of which condition we’re using within the chosen order


Opening code above
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Second code below


for (let i = 0; i < 6; i++) {
if (fractalChoice === fractalOrder[i]) {
fractalChoiceValue = learningOrder[i][0];
fractalChoiceSD = learningOrder[i][1]
break;
}
}

for (let i = 0; i < 6; i++) {
if (notFractalChoice === fractalOrder[i]) {
notFractalChoiceValue = learningOrder[i][0];
notFractalChoiceSD = learningOrder[i][1]
break;
}
}


Could this break the experiment for other participants?

Thanks!

Kind regards,
Bastiaan

Does this add one to the participant number (without knowing it) and then fetch the new value? I wonder if @apitiot could change the addIntegerValue command (and perhaps other similar shelf commands) so they return the new value without making a second call.

There could be an issue with not having await for the first line so the second line might be executed before the first line is finished.

1 Like

To my understanding, that is indeed exactly what it does. I should mention though that by no means I am a JS developer, so hard for me to tell what is going on under the hood exactly.

Do I understand your post correctly if I take away from it that adding the “await” command before “psychoJS.shelf.addIntegerValue({key: [‘participantNumber’], delta: 1})” might fix the issue?

Thanks for thinking along and helping me!

Kind regards,
Bastiaan

Yes, that might fix the issue.

1 Like

It did fix the issue! Thank you very much!