Severe memory leak issue for all browsers, task crashes for the majority of participants

Description of the problem:
Basic info about the task: I have a simple rating task where mainly participants read short stories which updates each trial and make a rating using a slider. I originally built the experiment using psychopy 3.1.0 and the generated js file has unversioned psychoJS. I just collected data on Prolific, which I only had 8 complete responses with 31 returned.

Question1: From the messages I received and incomplete results saved, for many people, the experiment crashed (suddenly froze/went black), and this happened to Firefox, Chrome and Safari on Windows and Mac. what’s the fix for this? According to this post (Increasing memory usage - memory leak?), the issue is not fixed for 2020.2.2 although it was supposed to be.

Question2: I have a general question on how to use the latest PsychoJS. Is importing the unversioned PsychoJS (does unversioned come with all the latest development?) enough? Or certain things happen with the compile process such that you have to download the latest Psychopy and then compile? I am just confused about this even after reading this post.

Question3:I collected some pilot data several months ago, at that time, the main issue was that some participants had an error ‘TypeError: Cannot read property ‘readPixels’ of undefined’ as reported in other posts (e.g.Type Error: readPixel web browser issue). I think this is gone now (waiting for some people to report back so not 100% sure), which makes me think that importing the unversioned PsychoJS fixed it. So I am benefiting from the better browser compatibility of the latest version, but then at the same time makes me concerned that the memory leak issue is still present in the latest version?

I really need to begin data collection soon, so any advice on how to proceed is appreciated. Thanks in advance!

@YT_HAN No problem, let me get on this, thanks for flagging, s.

Sorry would it be possible to give me developer access? Thanks, s.

sorry, you should be developer now

Perfect, thanks, s.

Hi there, I downloaded 2020.2.5 yesterday and re-compiled my script. After fixing some small things, I manage to get the task running online. The js file now uses the 2020.2 library. It seems that the memory issue is better now when testing on my local machine.

Q1: Is importing 2020.2 a true fix for memory leak? I am asking because one of the post I cited above still have this issue even using 2020.2 right? Do you think turning off log file would also help?
Q2: What exactly is the unversioned PsychoJS library, it’s definitely not the latest (2020.2), since I observe different behaviors between the two scripts using different libraries.
Q3: some things to fix for script using 2020.2 are
(1) text alignment changes now, am I correct that AlignHoriz(‘left’) still works, but the position specified in builder is now the left starting position?(used to be the center of the multi-line text)
(2) slider marker only shows up when I click at the exact middle position, it used to be anywhere on the slider, is there anything I can do with that?

Hi @YT_HAN, thanks again for taking the time to report these bugs. While I work on resolving the memory leak issue, please note unversioned PsychoJS components are meant for internal use and we would advise against importing those into your project. Please, could you better explain Q3.1? A fix for Q3.2 is on the way, x

Hi @sotiri: I figured out Q3.1 and thanks for the fix for Q3.2. Thanks for explaining the unversioned JS, I have switched to 2020.2.5 now which imports 2020.2 PsychoJS. Just to check, since the PsychoJS version is fixed, that should prevent the task from being affected by any latest changes, right? I will probably recruit some people this week to test memory leak using 2020.2.5 and will report back how it goes.

@YT_HAN No problem, thanks! Let’s say 2020.2 is the latest PsychoJS and 2020.2.5 the latest PsychoPy. But, the latest PsychoPy may produce slightly different boilerplate than previous versions in terms of how the .psyexp gets translated into JS. In other words, when you choose export HTML from PsychoPy, the combination of files that end up on Pavlovia may differ in content, if only slightly, independent of which version of PsychoJS you link to in your main script?

OK, let’s see if I understand correctly, both the version of Psychopy that I installed and the PsychoJS version that I selected affect the generated files. But if I don’t change both, that is, I just stick with Psychopy 2020.2.5 and PsychoJS 2020.2 and don’t make changes to the task, then the task should behave in a fixed way regardless of what latest updates the develop team are making, correct?

@YT_HAN Yes I see your point, great question, as it happens the PsychoJS that is served on Pavlovia may indeed include hotfixes as is the case with the slider bug you came across, x

I see, so I think those fixes are good. I was worried about changes like a different way of aligning text stim, but I assume those changes are not bugs and therefore will be included in a future release, rather than affecting the old versions?

OK let me ask our chief developer, apart from TextStim alignment what other changes are you worried about?

Thank you, I don’t have any particular concerns for now! The components that I use the most are text/slider/mouse/video(in another task), if there are anything that you guys plan to push changes to soon that would change the behaviors of those components a lot, it would be good to know. Otherwise, I suppose I should just keep an eye on the open issues here. https://github.com/psychopy/psychojs/issues

Alright, cool, FWIW we are in fact in the process of restructuring PsychoJS in ways that should hopefully address this type of problem, but it may take a while, thank you, x

1 Like

@sotiri Hello again. I have since done two pilot on Prolific (each recruits ~20 subjects). One is the rating stories as I described above, the other is almost equivalent, just replacing stories with videos. Using 2020.2.5, I had no report of technical issue for the story task, which is great. However, for the video one, I got a bunch of problems (14 completed successfully, but several had issues).

(1) there was an issue with import condition file, as someone else has also encountered, it only happened to 1 of my subjects, and he uses a rather old version of Firefox (66). I was just wondering if you think it’s only an issue for older browsers?

(2) two of my subjects report the button click didn’t work, both using chrome 86 on Mac. I am not sure what’s the problem, there are subjects with the same setting that finish just fine.

(3) three subjects have memory related issues I believe, using chrome 86 on linux/ chrome 86 on windows/firefox 82 on windows (again, I have ones with the same settings that finish just fine). they describe it as video just went blank and failed to load/having a glitch. I set the log file to be ERROR because setting it to be DEBUG generates really big log files, but still, any ideas why?

Hi @YT_HAN, huge thanks for another impressively meticulous report :blush: The input.matchAll error is indeed a browser compatibility issue, Firefox 67 onwards should be OK I believe.

Still looking for an answer to those memory leaks. All of the information you mention is very helpful, would you mind sharing a .psyexp for the video based project as well? Thank you, s.

Hi @sotiri, thanks for your answer to the matchall issue, I think most people use rather new versions of browsers so this shouldn’t be too much of a problem.

I have given developer access to you for 3 projects, ‘rating_story_set1’ is the old version for the stories; ‘rating_story_set1_test’ is the new version for the stories; ‘rating_video_set1_test’ is the new version for the videos. (I took down URL above as we are getting close to data collection). If you would like to run the task, just put happy as a scale. Let me know if any questions.

Right now, I am lost in terms of what to fix given that I do have successful responses and I couldn’t tell what went wrong for those that failed since others with the same setting can do the task. On subject using edge 86 on windows report to me that initially he clicked around and thought the screen was froze but then refreshes the screen and the task works all the way till the end.

Alright, cool, let me see if I can figure out what might have gone wrong. Thanks, s.

1 Like

https://github.com/psychopy/psychojs/issues/97 was the bug fix applied to all visual stim? Asking because text works, but not videos, just a thought.