-
Notifications
You must be signed in to change notification settings - Fork 13
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
Pyro Proxy resource allocation fix #69
base: develop
Are you sure you want to change the base?
Conversation
2.Improve the example and actively release the connection
Thanks for the pull request. Could you provide some code that and explanation that shows which resources were not released. So that we can reproduce the problem that you wanted to solve before your changes and after. Keep in mind that the code the resources should also be released when an exeption happens wihin the code. |
Thanks for your reply !
Since Pyro5 has not established a connection, it has no effect inside the For the second,During my use, the server-side encountered the following error
Through checking the code of Pyro5, I found that the reason for this error is that Pyro5 can support up to 80 client connections by default, with each client being an independent thread managed by a thread pool. Due to the low configuration of my server computer, even when the number of threads is less than 80, the system is unable to create new threads, resulting in an error. The key issue is that I only have one client! The pseudocode is as follows:
The working principle of Pyro5's server is that there are four idle threads by default. Whenever a client connects, they will use one idle thread and add it to the busy thread group. When there are no idle threads, if the total number of threads is less than 80, it will create a new thread. Whenever a client disconnects (client call So, theoretically speaking, every time my client executes a loop, the opc_client is re instantiated, old opc_client will be released by GC due to loss of references, the old opc_client In addition, it is difficult for me to reproduce this issue locally in a short period of time. I am not sure if this is related to the complex GC mechanism. I have not yet obtained GC, but I can be certain that adding If I haven't described it clearly, please let me know |
1.Remove invalid context management
2.Improve the example and actively release the connection
Although Python has GC that can automatically release resources, when I use it, some resources on the server still cannot be automatically released, causing an exception
After checking Pyro5,The problem was solved when I added the code for actively releasing resources on the client side.
All of this PR hopes to improve this example for other project users