async-listener icon indicating copy to clipboard operation
async-listener copied to clipboard

Context preservation fails for `zlib.unzip`

Open rf opened this issue 10 years ago • 6 comments
trafficstars

Here's a failing test on my fork. It seems to work in the case of zlib.gzip but when I try to use unzip my global variable doesn't get preserved. If you replace the call to zlib.unzip with a process.nextTick, it'll work.

Am I misunderstanding the use of this, or is this a bug in the way zlib is wrapped?

@sh1mmer @Raynos @othiym23

rf avatar Dec 22 '14 17:12 rf

cc @creationix

Raynos avatar Dec 22 '14 17:12 Raynos

@rf which version of node ?

Looking at the source code I dont see anything different between gzip & unzip in node.

Raynos avatar Dec 22 '14 18:12 Raynos

I was running the test with v0.10.26. I just tried with node v0.10.34 and I'm still seeing my test fail. I looked at the source as well and figured the same thing, so I'm not sure what's going on here.

rf avatar Dec 22 '14 18:12 rf

@rf try running the tests in different orders, it might not be gzip vs unzip, it might be the first one wins & second one fails.

Raynos avatar Dec 22 '14 18:12 Raynos

Tried that too. The unzip test will consistently fail, even if they are run separately or the unzip test is run first.

And the gzip test consistently succeeds. Tried with v0.10.26 and v0.10.34.

rf avatar Dec 22 '14 18:12 rf

I'll take a look. It's possible there's something wacky with native bindings going on under the hood and the default wrapping method won't work for zlib. Thanks for the report!

othiym23 avatar Dec 22 '14 18:12 othiym23