Skip to content
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

100% CPU with ExtEventLoop #109

Closed
kelunik opened this issue Oct 11, 2017 · 10 comments
Closed

100% CPU with ExtEventLoop #109

kelunik opened this issue Oct 11, 2017 · 10 comments

Comments

@kelunik
Copy link
Contributor

kelunik commented Oct 11, 2017

See https://gist.github.com/kelunik/79f843c541aceb3927c5463cc643d502 for a reproduction script.

While the child process runs, php test.php consumes 100% CPU when running on the ExtEventLoop. Additionally, the connection is closed directly instead of one second later if there's currently a child process running.

See also https://twitter.com/kelunik/status/917757971790286848 and replies.

@clue
Copy link
Member

clue commented Oct 12, 2017

Thank you for filing this issue! I think it serves as a valid reference that suggests reactphp/child-process#51 may actually be an issue for some use cases.

Given that it's related to this known issue in another component, I don't see much that we could do here in this component.

I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can reopen this 👍

@clue clue closed this as completed Oct 12, 2017
@kelunik
Copy link
Contributor Author

kelunik commented Oct 12, 2017

@clue It works fine with the StreamSelectLoop. While it might be related to the linked issue, it probably shouldn't result in 100% CPU usage. The only expected issue with reactphp/child-process#51 is connections being kept open, but stream_socket_shutdown seems to solve that. Without stream_socket_shutdown, I get the expected hanging behavior with the StreamSelectLoop. I believe this is a separate issue.

@clue
Copy link
Member

clue commented Oct 12, 2017

Can you send in a gist to reproduce this issue without the known issue linked above? Thank you.

@kelunik
Copy link
Contributor Author

kelunik commented Oct 12, 2017

Please re-open the issue, so I don't forget about it.

@clue
Copy link
Member

clue commented Oct 12, 2017

No worries, I'll make sure to ping you if nothing changes about this issue in a few days and will reopen if you send a gist to reproduce this! 👍 Thank you.

@clue
Copy link
Member

clue commented Oct 20, 2017

Ping @kelunik, I suppose this is still resolved? 👍

@kelunik
Copy link
Contributor Author

kelunik commented Oct 20, 2017

It's weird. If I try to look into it with phpdbg and pause the execution and continue it again, the 100% CPU usage is gone. Seems to be a Heisenbug. Haven't found another reproduction case, because I'm not sure what causes it. So no, it's not resolved as stated previously. It's not the expected misbehavior that reactphp/child-process#51 might cause, as previously stated.

@clue
Copy link
Member

clue commented Oct 20, 2017

@kelunik Thanks for trying to dig into this. If you happen to find a way to reproduce this, I'm happy to re-open this so we can look into this 👍

@lajosbencz
Copy link

I've ran into this issue aswell, i'm installing react/child-process:0.6.1 from composer, and the default event loop (React\EventLoop\ExtUvLoop) consumes 100% of the CPU.
If i explicitly set it to StreamSelectLoop, the process works as expected at around 5-10% CPU usage.

The project im using it in: https://github.com/lajosbencz/phrocman

Could it be purely related to the loop implementation, and nothing to do with the component itself?

@clue
Copy link
Member

clue commented Jan 15, 2020

@lajosbencz We're not aware of any such issues at the moment. Can you provide a minimal test script to reproduce this locally?

If this is related to spawning child-processes, can you take a look at one of the possible work-arounds for reactphp/child-process#51, such as clue/reactphp-sqlite#7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants