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

Circular JSON structure crash #64

Open
renanccastro opened this issue Jun 24, 2020 · 3 comments
Open

Circular JSON structure crash #64

renanccastro opened this issue Jun 24, 2020 · 3 comments

Comments

@renanccastro
Copy link

@renanccastro renanccastro commented Jun 24, 2020

Hello, everyone.
We are using this library to push logs to loggly with Winston and Meteor, but some circular JSON structure is crashing our servers from time to time.
Any clues on what could be done on the library level to avoid this?

This is some of the logs we have:

2020-06-24 11:54:30-03:00Error: Unspecified error from Loggly: TypeError: Converting circular structure to JSON
wwzj4
2020-06-24 11:54:30-03:00 --> starting at object with constructor 'Error'
wwzj4
2020-06-24 11:54:30-03:00 --- property 'note' closes the circle
wwzj4
2020-06-24 11:54:30-03:00 at /app/bundle/programs/server/npm/node_modules/meteor/pathable-logs/node_modules/node-loggly-bulk/lib/loggly/client.js:204:18
wwzj4
2020-06-24 11:54:30-03:00 at Request._callback (/app/bundle/programs/server/npm/node_modules/meteor/pathable-logs/node_modules/node-loggly-bulk/lib/loggly/common.js:209:15)
wwzj4
2020-06-24 11:54:30-03:00 at Request.self.callback (/app/bundle/programs/server/npm/node_modules/meteor/pathable-logs/node_modules/request/request.js:185:22)
wwzj4
2020-06-24 11:54:30-03:00 at Request.emit (events.js:311:20)
wwzj4
2020-06-24 11:54:30-03:00 at Request.EventEmitter.emit (domain.js:482:12)
wwzj4
2020-06-24 11:54:30-03:00 at Request.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/pathable-logs/node_modules/request/request.js:1154:10)
wwzj4
2020-06-24 11:54:30-03:00 at Request.emit (events.js:311:20)
wwzj4
2020-06-24 11:54:30-03:00 at Request.EventEmitter.emit (domain.js:482:12)
wwzj4
2020-06-24 11:54:30-03:00 at IncomingMessage.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/pathable-logs/node_modules/request/request.js:1076:12)
wwzj4
2020-06-24 11:54:30-03:00 at Object.onceWrapper (events.js:417:28)
wwzj4
2020-06-24 11:54:30-03:00 at IncomingMessage.emit (events.js:323:22)
wwzj4
2020-06-24 11:54:30-03:00 at IncomingMessage.EventEmitter.emit (domain.js:482:12)
wwzj4
2020-06-24 11:54:30-03:00 at endReadableNT (_stream_readable.js:1204:12)
wwzj4
2020-06-24 11:54:30-03:00 at processTicksAndRejections (internal/process/task_queues.js:84:21)

Thanks for the help!

@Katulus
Copy link
Collaborator

@Katulus Katulus commented Jun 25, 2020

Hello @renanccastro, it looks that the object you are sending through the library contains circular reference and when it's being converted to JSON string it throws this error.

Can you figure out if it's throwing this error for some specific log statements?

@renanccastro
Copy link
Author

@renanccastro renanccastro commented Jun 25, 2020

Sorry, we can't identify exactly the log with the error.
It seems like the library could get some safety wrap around the arguments, so it doesn't happen. What do you think?
Or at least catch and warn about it instead of throwing the error. Would a PR be welcome?

@Katulus
Copy link
Collaborator

@Katulus Katulus commented Jun 25, 2020

Sure, since you can reproduce the issue feel free to create a PR and we'll check it and merge if it's OK.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.