Invalid string length: when quitting experiment

URL of experiment:

Description of the problem:

Hi, All.

I am keep encountering an error message saying “invalid string length”, whenever I finish my experiment.
The experiment works fine, the data is saved, but the final line return Scheduler.Event.QUIT; ‘sometimes’ doesn’t work. I am currently testing with the pilot mode, but when I run this as run mode, my credit was consumed.

When I download the data file (as I am running in pilot mode), an error message appears after 10s of pause, which is quite long…

This is an error message that I got,


and this is an error message that appears at my console.

Can you help me with this problem?

Do you have any End Experiment code? I’m wondering whether you are simultaneously ending and quitting the experiment.

No, I don’t have any End Experiment code.

I finish the experiment by pressing a space bar, but the error message still appears when I remove the keyboard component.
When running in pilot mode, the data file is saved after I press the space bar, I wait about 10 - 20 seconds, then the error message appears without green box (saying thank you for your patience).
And, pavlovia doesn’t return the message always. The experiment is finished normally sometimes, but is crashed in some occasions.

Please could you add me (Wake) as a Developer so I can investigate further. I’m keen to investigate issues with data saving (post experiment completion)

Yes, I added you as a developer!

In Experiment Settings you have “Show info dialog” unticked. The dialog box is still showing online but it might be that there is a knock on effect since the value for participant is checked when saving the data.

Please could you try changing that? Do you have other experiments where there isn’t a problem and the show info dialog is ticked?

I am trying your suggestion. I will let you know the results after several attempts.

My previous experiments were okay and the show info dialog was always ticked.

Still facing the same error…

I think the error is coming from the final dialog box…
Do you know how I can end experiment without showing dialogue box?

I’ve just tried piloting it a couple of times and have crashed with a memory error before reaching the end. I think that the issue is the amount of data that is getting saved. In Pavlovia, all data is stored in memory until the end, whereas in PsychoPy running locally it gets saved during the experiment. Do you need so much data for every single berry clicked?

It might be worth testing this theory by commenting out most of the data saving calls in Each Frame code components.

Another thought would be to move psychoJS.experiment.addData(“hitcode”, hitnum); from End Routine of the final routine to Begin Routine.

N.B. You can type thisExp.addData(‘hitcode’, hitnum) in an Auto code component and it will translate correctly.

I have no psychoJS.experiment.addData(“hitcode”, hitnum) in my js file (I was manually updating the git repository because I had a post-processing after exporting html files from PsychoPy), so this would not be the reason.

Memory would be the reason… It was just my hunch, but the error seems not appearing when I test the experiment with reduced time length. I still need every single berry clicks. I will try again with a little bit of modifications on my code: save the data at an array then save the array once when the trial is over

In that case the error you are seeing may be related to a bug in your edits which can’t easily occur when editing in Builder. I strongly discourage direct editing.

I changed the way I save data (collect the data in an array then save when the trial is over), but I still face the error. I think the final error is not due to the memory problem.

Did you get this error before editing the code directly on GitLab?