Skip to content
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

Browser hang when logging console message #15

Open
stephent opened this issue Jul 26, 2021 · 5 comments
Open

Browser hang when logging console message #15

stephent opened this issue Jul 26, 2021 · 5 comments

Comments

@stephent
Copy link

stephent commented Jul 26, 2021

After putting my create-react-app into production using logdna-browser, I received two reports from end users of the browser hanging completely. My suspicion is that it is the same problem as this issue: pinojs/pino#990

On reverting the update that added logdna-browser, the same users reported the hanging problem was gone. I asked one of the users to send their browser console output to see what was there that might have been triggering the problem. I think it's likely to be the non-fatal error shown below (from somewhere deep in threejs):

ExpandedConsole

(FWIW, this looks like it contains an instance of https://github.com/mrdoob/three.js/blob/master/src/math/Box3.js)

Additionally, I confirmed that logdna-browser is the only package in my project that uses fast-safe-stringify:

 npm ls fast-safe-stringify
tpe-web-app@2.6.7 
└─┬ @logdna/browser@1.1.2
  └── fast-safe-stringify@2.0.7 

I've not been able to reproduce the browser hang so far, but I suspect outputting an object that contains circular references may trigger it.

@stephent
Copy link
Author

Also likely relevant: davidmarkclements/fast-safe-stringify#46

@TerryMooreII
Copy link
Collaborator

@stephent Thank you for reporting this. I will read up on the issues that you posted and try to reproduce the issue.

@stephent
Copy link
Author

BTW, this is my config for logdna-browser:

import logdna from '@logdna/browser';

logdna.init(process.env.REACT_APP_LOGDNA_INGESTION_KEY,
  {
    console: {
      integrations: ['log', 'info', 'warn', 'error']
    },
    enableStacktrace: false,
    env: process.env.NODE_ENV,
  }).addContext({
    // Context is appended to the metadata of each message sent to LogDNA
    // Add any custom meta data such as:
    version: process.env.REACT_APP_VERSION
  }
);

@TerryMooreII
Copy link
Collaborator

@stephent From what I have found out the issue is that the library we (and pino) use to handle the circular references is unable to handle large objects with deeply nested circular reference with out hanging the browser. Unfortunately, I have not been able to duplicate this issue with three.js. But I did open a draft PR that switches the browser logger to use a different package for handling circular reference when stringifying the logs. If you have been able to duplicate this issue locally, could you can pull down that PR and test to see if it handles the circular references without hanging the browser?

@stephent
Copy link
Author

@TerryMooreII thanks for the update on this. I'm unable to reproduce locally - I think my only option is to push out a public beta and get some testers to try it out. How do I reference your version with the PR in my project's package.json?

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

No branches or pull requests

2 participants