Skip to content

Conversation

@kelunik
Copy link
Member

@kelunik kelunik commented Feb 4, 2022

We hit this issue in https://github.com/amphp/file/blob/858c2a46fc799e6775c3e992134eae57d1d58c49/src/Internal/UvPoll.php#L17 with a dummy timer to keep the event loop running.


if ($callback instanceof TimerCallback) {
$interval = \max(0, $callback->expiration - $now);
$interval = \min(\max(0, $callback->expiration - $now), \PHP_INT_MAX / 2);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP_INT_MAX / 2 isn't a great solution, and will likely break in 2038 depending on the internal timer used?

@rekryt
Copy link

rekryt commented Feb 14, 2022

I made a visual test application for checking memory leaks. Here's how they can currently be played:
https://github.com/Rekryt/ratchet-revolt-example/blob/master/src/WSExampleTask.php#L18

@trowski trowski merged commit 4e14f0a into main May 31, 2022
@trowski trowski deleted the fix-overflow branch May 31, 2022 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants