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

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.

Good catch, yes that tweak applies to all visual stimuli. I hear you that there are still issues with the movie component, but because other video playback weirdness went away when upgrading PIXI, I’m hopeful that may eventually help with the memory leaks as well.

I plan on spending most of tomorrow on this and will no doubt be posting back here as soon as I have a better understanding of where the problem lies, because I have been unable to reproduce on my development machine so far. Thanks again for your patience while I look for a solution, x

Hi @YT_HAN, I believe the issue you are having and is shared across all three projects is with the backspace preventing keydown event handler being attached to the document on each frame. That is 100% a memory leak risk factor. I have added an extra branch to your video study to demonstrate a possible fix plus the post PIXI upgrade tweaks required to get your movie components to run more reliably. Please let me know if those changes fail to solve the problem, x

hi @sotiri, Thanks so much for getting back to me so quickly.
In my tasks, I have the main rating part and then 8 trials for retest in the end where I also ask for a text input, so I used the backspace code to make sure backspace act as a delete key rather than taking people back to previous website as firefox do. Does the fix still achieve that purpose?
I can see your branch, but how do I run it?

No problem @YT_HAN, yes the only difference is that the keydown event handler is added only once, instead of on each frame, which as you can imagine leads to a stacking up of needless callbacks.

To run the fix you can accept a merge request I just created on GitLab or even edit your JS manually because the changes required are not that many. Please do let me know if you need more details, s.

thank you, I just tested and it all works fine (but things always work on my machine :sweat_smile:). I will try to contact the subjects who had memory issues to do it again and will report back.

I do want to ask if you have any insights for the 2nd problem that I mentioned before, that is, people report that the screen doesn’t respond when they click buttons (also encountered here). I can only reproduce the issue on my old Mac, using safari 12.1.2, and there were two people using chrome 86 on Mac who also experienced this. No error messages are shown, just nothing happened.

Sorry, yes, re: valid taps going undetected, very likely a side effect of how PsychoJS is wired to pick up mouse events on every animation frame. You could try adding actual HTML buttons, but I suspect it might be easier to advise your participants to only expect button-like components to fire against full clicks instead of just taps if that makes any sense, x

what you said makes sense, but I did click (not just tap) and the screen doesn’t respond

Hm, OK is that for all three projects?

when testing on my old Mac, yes, all three projects. So far it only happened to Mac users it seems (for the video one, but I only did 20 per study, so not sure about the other two), but many Mac users have no issues (for example, I have no issues with safari 13.1.2 on my new Mac).
I used a lot of mouse.getPressed()[0] === 1 to move on to next part of the task, would that be a problem?
Another unrelated question, if I make edits now in builder code components, and then sync, i would lose the edits you made, right? So do I then manually change the js file every time after I sync?

To answer your last question first, yes. About mouse clicks not firing I need investigate some more :nerd_face:

Sorry, to be clear, when exporting HTML you basically loose the custom lib imports. The keydown handler fix you can just paste into your builder each frame block and it should work, x

thank you, it makes sense.

Hi @sotiri, using my old Mac that could reproduce the button click not responding issue, I think the problem has to do with mouse position not being detected (on my machine, it was safari only, but for two subjects, it was chrome on Mac). When logging the mouse position, no matter how I move it, it was always (-1.2,0.5) and therefore no contain/press method could work. I am using height units, so boundaries are (+/-0.8,+/-0.5) for a screen ratio of 16:10, right? Any ideas why the mouse position is set to be outside of the screen? A similar issue was reported here.

EDIT: I’ve seen some old posts discussing that this might be related to Retina display?

Hi @YT_HAN, OK on it, thanks for the details, cheers, x

Great, thank you @sotiri .
Just to add, for my Mac, it occurred for both stories and videos. When tested, it wasn’t consistent, some Mac users have no problem, others do. It would be good to understand what the problem is, ideally solve it, but if there’s enough info on what kind of situations it won’t work, then I can instruct the subjects, which would also be helpful.
By the way, I am still waiting for some subjects to get back to me. I think it doesn’t affect the running tasks if changes are made on a branch, right?

I hear you @YT_HAN, I’m sorry PsychoJS is giving you problems. I’m looking into improving mouse behaviour and contains() calculations at the moment. I’m hoping I can have the issue addressed for good before too long. If by changes made on a branch you mean other than master, then yes they should have no effect on the running experiment. More soon, thanks, x

@sotiri, in this particular case, I think the issue is more related to getPos() (as that was giving me the constant off-screen positions), rather than the contain method (which depends on the correct results from getPos I assume). Let me know if you want to test anything since I can reproduce the error on my machine.

I didn’t mean to push, but it would be great if you can give me a rough estimate on how long it would take to address this. Just so that I can decide whether to wait a bit for main data collection (which would be on the scale of hundreds of subjects) or bite the bullet.

Hi @YT_HAN, since you are able to reproduce, is it both buttons next and finished across trials?

@sotiri, not sure I understand you correctly. Yes, both buttons are programmed to be clickable. But the issue is that I got stuck at the start instruction page in the very beginning, where I need to click ‘next’ to proceed (there was no finished button in the start routine). But clicking has no response, because mouse position is not correctly logged when examining using getPos method. Is that what you are asking for?