Skip to content

Attempting to stringify large variable results in an error log #3441

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

Open
ksen0 opened this issue Apr 8, 2025 · 1 comment · May be fixed by #3461
Open

Attempting to stringify large variable results in an error log #3441

ksen0 opened this issue Apr 8, 2025 · 1 comment · May be fixed by #3461
Labels

Comments

@ksen0
Copy link
Member

ksen0 commented Apr 8, 2025

p5.js version

dev-2.0 branch

What is your operating system?

None

Web browser and version

Chrome

Actual Behavior

Because of an attempt to stringify a large variable, error is logged in browser.

Expected Behavior

Do not try to stringify objects that are [expected to be] excessively large

Steps to reproduce

Observed in: processing/p5.js#7693

Image

Notes from the above thread:

"that's a p5 web editor bug, it's trying to stringify the whole font including parsed font data, which is too large of an array."

"that would be great thanks! we may want to just add a special case there for p5.Font to ignore some propertiesI feel like we had similar issues in the past with vectors having a reference in them to the p5 instance"

@ksen0 ksen0 added the Bug label Apr 8, 2025
@lirenjie95
Copy link

lirenjie95 commented Apr 23, 2025

Hi @ksen0 and @dhowe, I'm trying to debug this error, below is what I did to reproduce it:

  1. open the demo https://editor.p5js.org/davepagurek/sketches/9MJzIBMBW
  2. remove the line debugger, add one line after the let font = await loadFont('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap', { sets: 'latin' }) to print the font console.log(font)
  3. click the ▶️ button
  4. wait......
  5. the issue shows as above

In addition, I checked the repo and plan to add check for p5.Font at those two files, please correct me if I missed any other place:

  1. https://github.com/processing/p5.js-web-editor/blob/develop/client/utils/previewEntry.js
  2. https://github.com/processing/p5.js-web-editor/blob/develop/client/modules/IDE/hooks/useHandleMessageEvent.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants