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 usage problem #110

Closed
aiden0z opened this issue Oct 21, 2021 · 1 comment
Closed

100% cpu usage problem #110

aiden0z opened this issue Oct 21, 2021 · 1 comment
Labels
Milestone

Comments

@aiden0z
Copy link
Contributor

aiden0z commented Oct 21, 2021

The _process_incoming_data may cause 100% cpu usage problem when read data from bad socket fd.

    def _process_incoming_data(self):
        """Retrieve and process any incoming data.
        :return:
        """
        while self._running.is_set():
            if self.poller.is_ready:
                self.data_in += self._receive()
                self.data_in = self._on_read_impl(self.data_in)
  1. py-spy output

image

  1. get the problem thread

image

  1. strace found select syscall return immediately and recvfrom syscall read zero data.

image

We should check the received data length to fix the dead loop problem.

Ref: The Redis client how to check the received data length. https://github.com/redis/redis-py/blob/16cfcc7fced84d2b53edf95af1c40b230b30fc3d/redis/connection.py#L435

@eandersson
Copy link
Owner

Thanks @aiden0z !

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

No branches or pull requests

2 participants