reactphp / filesystem

Evented filesystem access.
MIT License
135 stars 40 forks source link

Error while running tail example #81

Closed developernaren closed 4 years ago

developernaren commented 4 years ago

While running the example for tailing the file.

Notice: Undefined offset: 0 in /Users/Extras/project/vendor/react/filesystem/src/ChildProcess/Adapter.php on line 198

Call Stack:
    0.0007     405784   1. {main}() /Users/Extras/project/index.php:0
    0.0181    2787608   2. React\EventLoop\StreamSelectLoop->run() /Users/Extras/project/index.php:40
   26.2127    3339672   3. React\EventLoop\StreamSelectLoop->waitForStreamActivity() /Users/Extras/project/vendor/react/event-loop/src/StreamSelectLoop.php:212
   26.2131    3340152   4. React\Stream\DuplexResourceStream->handleData() /Users/Extras/project/vendor/react/event-loop/src/StreamSelectLoop.php:245
   26.2131    3410184   5. React\Stream\DuplexResourceStream->emit() /Users/Extras/project/vendor/react/stream/src/DuplexResourceStream.php:193
   26.2131    3410184   6. React\Stream\Util::React\Stream\{closure:/Users/Extras/project/vendor/react/stream/src/Util.php:70-72}() /Users/Extras/project/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:123
   26.2131    3410560   7. React\Socket\Connection->emit() /Users/Extras/project/vendor/react/stream/src/Util.php:71
   26.2132    3410560   8. WyriHaximus\React\ChildProcess\Messenger\Messenger->WyriHaximus\React\ChildProcess\Messenger\{closure:/Users/Extras/project/vendor/wyrihaximus/react-child-process-messenger/src/Messenger.php:67-71}() /Users/Extras/project/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php:123
   26.2132    3410528   9. WyriHaximus\React\ChildProcess\Messenger\Messenger->handleData() /Users/Extras/project/vendor/wyrihaximus/react-child-process-messenger/src/Messenger.php:70
   26.2132    3411280  10. WyriHaximus\React\ChildProcess\Messenger\Messenger->iterateMessages() /Users/Extras/project/vendor/wyrihaximus/react-child-process-messenger/src/Messenger.php:216
   26.2132    3412584  11. WyriHaximus\React\ChildProcess\Messenger\Messages\RpcSuccess->handle() /Users/Extras/project/vendor/wyrihaximus/react-child-process-messenger/src/Messenger.php:223
   26.2132    3412904  12. WyriHaximus\React\ChildProcess\Messenger\Messenger->WyriHaximus\React\ChildProcess\Messenger\Messages\{closure:/Users/Extras/project/vendor/wyrihaximus/react-child-process-messenger/src/Messages/RpcSuccess.php:53-55}() /Users/Extras/project/vendor/wyrihaximus/react-child-process-messenger/src/Messages/RpcSuccess.php:57

I get this error pretty frequently when running multiple processes without await. I was not able to reproduce this error. But the tail example in this repo reproduces this error. I tried the same thing with PHP7.3 and PHP7.4. The error is the same. In this particular case.

https://github.com/reactphp/filesystem/blob/master/examples/tail.php#L30 the error is thrown the file actually changes.

Please, let me know if I could help.

ghost commented 4 years ago

The bug you're seeing is fixed with PR #56. Since the bugfix hasn't been released yet, you may want to install the master branch to have it fixed meanwhile, i.e. composer require react/filesystem "dev-master as v0.1.99".

developernaren commented 4 years ago

Cool. I will use this.