-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Memory leak in TcpServer due to PHP stream_context_create memory leak #303
Comments
So this only becomes an issue if you rapidly create temporary socket servers and shut them down again, correct? Also looking at that PHP issue, well done! |
@WyriHaximus Yes, In my use case the services are writing out a state file every 1 second. So each second there is a Filesystem putContents to a temp file followed by a rename. This is using Reach Filesystem Child Process, EIO is unusable per the previous tickets opened. react-child-process-messenger makes good use of TcpServer to do the RPC work, so when doing file operations you rapidly leak memory. |
@lucasnetau Thank you for confirming my thoughts on how this was leaking 👍. |
@lucasnetau I agree with @WyriHaximus, thanks for your work on this one 👍 In my opinion it is not necessary to add documentation for this to the Great job on the memory leak tho! |
Update: The memory leak on PHP's side has been fixed via PHP 8.2.5 and PHP 8.1.18. This doesn't seem to be a bug in ReactPHP, so I will change the label of this ticket and close it, as it seems like everything in here has been answered. Thanks again to @lucasnetau for reporting this 👍 |
Hi @clue @WyriHaximus @SimonFrings , I wanted to bring to your attention an internal PHP memory leak (php/php-src#10885) I found which has been affecting me with TcpServer (Specifically through react-child-process-messenger + react/filesystem).
Essentially for each instance of TcpServer, PHP was allocating 720+ bytes that was never released until shutdown, seems to have always existed since PHP4 days https://3v4l.org/XBaaP
The good news is the PHP team quickly provided a patch which has been merged into PHP8.1, 8.2, Master so the next releases will have a fix. It may be useful to add some documentation to TcpServer of this issue for memory constrained environments where there is a high churn of TcpServer instances.
The text was updated successfully, but these errors were encountered: