bluebird icon indicating copy to clipboard operation
bluebird copied to clipboard

Ability to disable forced serialization of error.stack

Open spion opened this issue 5 years ago • 6 comments

  1. What version of bluebird is the issue happening on?

Most versions since 2.x

  1. What platform and version? (For example Node.js 0.12 or Google Chrome 32)

All platforms

Bluebird forces serialization of error.stack. In test environments with source maps support (for example, jest) this causes test timeouts since bluebird will attempt to read the stack string, blocking the test up to a few seconds.

Test case to reproduce coming soon - in the mean time I wonder what precisely was the original reason that we forced this serialization.

spion avatar Feb 13 '19 01:02 spion

Previous issues: https://github.com/petkaantonov/bluebird/pull/1285

spion avatar Feb 13 '19 01:02 spion

Are you talking about Promise.coroutine?

benjamingr avatar Feb 13 '19 08:02 benjamingr

No, it seems that bluebird might always be forcing serialization of error.stack - I'm not sure yet. I opened a jest issue too https://github.com/facebook/jest/issues/7879

spion avatar Feb 13 '19 16:02 spion

Forced serialization is to avoid memory leak isn't it?

petkaantonov avatar May 24 '19 14:05 petkaantonov

Yes, but if there was a way to disable it for test environments, it would probably help. There regardless of whether the stack is actually needed if there is a promise error, it gets force-serialized which is really slow with source maps enabled and times out the first test.

spion avatar May 24 '19 16:05 spion

I see, could probably create a flag for lazy serialization? PR welcome

petkaantonov avatar May 24 '19 18:05 petkaantonov