-
Notifications
You must be signed in to change notification settings - Fork 107
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
v4 doesn't release resource #421
Comments
I tried with both the version of if not than you have to mention explicitly Please refer this for more information. I tried downgrading the mocha to 3.x in above given repository and it's working fine. |
I will create a test matrix on the weekend that uses the latest version of 3 and 4 of the datastore Last time when I tried on my Mac pro the 3.x exited correctly |
In the logs, you can see v3 works fine v4 hanging |
@ert78gb try using |
Never, it is hide the resource management problems. It was the reason why changed the default behavior of mocha and I agree with it |
@ert78gb I appreciate the reproduction case, but is it possible to narrow it down to the smallest possible scenario? This makes the debugging process a lot more straightforward, since in this case I would be able to bypass the custom classes and Docker integration. |
I will create a very simple example tomorrow.
The script will not exist. |
Thank you very much for your help! |
sure. I also would like to know what is the root cause :) |
@stephenplusplus Sorry for the late answer. But was very hard to reproduce the problem. When I created the sample repo I can not reproduce the bug with the v4 of Datastore, so I tried to investigate what is the problem. What happens in the datastore-emulator tests:
Mocha exists only when no pending event in the event loop.
The Http2Channel of the grcp-js has a close method. If I see well it stops the timer that blocks the exits of the event loop. It is possible to add a close() method to the Datastore client that call Http2Channel.close()? |
@stephenplusplus What do you think about my prev comment? |
@ert78gb sorry for the delay. I have been working on this, but I'm still hoping you could present the issue in a way that's detached from the wrapper you've written. I've spent a lot of time trying to work within it and make sure any holes that might exist are plugged, but there are too many variables to be able to track it down with confidence. As a start, maybe you could assume a Docker instance is already running and remove the standing up and tearing down logic? Ideally, something so small and using only our library that it leaves only us to blame 😆 |
The small repo that contains only the datastore emulator code |
Thanks! The idea of implementing a @JustinBeckwith @bcoe @callmehiphop @AVaksman -- grpc-js opens a channel with a server, then if the connection is interrupted, it runs an interval to check back and see if the server comes online again. This can be reproduced by stopping the Datastore emulator after a single call, So, this works:
And this works:
But this doesn't:
So, it seems like after we get the response from calling |
I believe I have found a solution to expose the channel's close method. PR coming shortly! |
thx. I am waiting. |
Sorry for the lack of an update. Turns out there’s a bug with grpc that has an open PR for a fix: grpc/grpc-node#1015. When that goes, the original behavior will be restored, and the script should exit as expected. |
@stephenplusplus it looks like the upstream work for @ert78gb can you confirm that things are working? |
With the |
@ert78gb 👍 awesome, I'm glad this has addressed your issue. We will work on explicitly updating the version # of grpc this week. In the mean time, I think you should get the desired effect by I'm going to go ahead and close this issue since the underlying issue is addressed. Let me know if you bump into any more issues. |
Thanks for stopping by to let us know something could be better!
The library does not release a resource and the unit tests don't exist.
Is there a new command that we have to call before exiting from the application?
Environment details
@google-cloud/datastore
version: 4.0.0Steps to reproduce
$ docker pull google/cloud-sdk:latest
$ git clone https://github.com/ert78gb/google-datastore-emulator.git
$ cd google-datastore-emulator
$ npm i
$ npm install --no-save @google-cloud/datastore
$ npm test
All test is pass, but mocha does not exists. The reason is there is a resource, timer, promise that running in the background and mocha waiting for the exit.
The 3.1.2 version of the lib worked perfectly, but something changed. You can see it in the travis build logs https://travis-ci.org/ert78gb/google-datastore-emulator/builds
I don't want to use
process.exit()
at the end of the test, because it hides resource release problems and it is also not a good practice.Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
The text was updated successfully, but these errors were encountered: