Giter Club home page Giter Club logo

Comments (8)

mbonneau avatar mbonneau commented on May 22, 2024 1

I had issues that sound similar to this #26.

Stream buffering in PHP will cause LibEvent to not fire (because php has already buffered input).

Try adding:

stream_set_read_buffer($stream, 0);

That will force PHP not to try and buffer itself.

from event-loop.

WyriHaximus avatar WyriHaximus commented on May 22, 2024

This looks like a very neat project. The factory creates the best performant loop it can find, falling back to the StreamSelectLoop. Could very well be a LibEventLoop quirk or something else. Do you have a gist for me I can use to try and reproduce the problem?

EDIT: Forgot to add this, does the event show up several seconds to a minute or two later when you don't press an extra key?

from event-loop.

mbonneau avatar mbonneau commented on May 22, 2024

There is a PR for the issue (if this is the issue) over in react/stream (reactphp/stream#20).

This is the line that is added:
https://github.com/reactphp/stream/blob/4da0128801a7342bbada6a0fe7dea4f5b2092139/src/Stream.php#L27

from event-loop.

toverux avatar toverux commented on May 22, 2024

@WyriHaximus thanks for your answer, I was writing the minimal code to reproduce the bug when mbonneau posted the solution.

@mbonneau Fantastic! Works like a charm. I thought my issue would be much harder to fix than that :D Good to see that a pull request to fix this behaviour is (slowly) integrated.
Note that I'm not using the Stream API because I only need a small subset of it, I use only the event loop, so it could be great to add a note about that into the documentation of this repository, I think it's pretty important to warn users about that (or the React's event loop can also force the buffer to zero when a stream is passed in addReadStream/addWriteStream but I don't know if it is a good idea to do this as the default behaviour).

from event-loop.

clue avatar clue commented on May 22, 2024

@mbonneau Fantastic! Works like a charm. I thought my issue would be much harder to fix than that :D Good to see that a pull request to fix this behaviour is (slowly) integrated.

Thanks for posting back that this does indeed fix the problem!

Note that I'm not using the Stream API because I only need a small subset of it, I use only the event loop, so it could be great to add a note about that into the documentation of this repository, I think it's pretty important to warn users about that

I agree that we need some documentation about this in this project. After all, the documentation explicitly states that this library can be used standalone without React's stream component (though it probably hardly ever will). See also reactphp/stream#28 for some background on why this may be needed.

from event-loop.

mbonneau avatar mbonneau commented on May 22, 2024

I did not realize that event-loop was designed to be used standalone.

In this case, it would make sense to move stream_set_read_buffer from the stream library to LibEventLoop so that other users of the library are not caught by this and also because it only effects LibEventLoop (actually, I don't think I have tried Ev). In the long term, this may be something that should be corrected in the extension itself.

from event-loop.

clue avatar clue commented on May 22, 2024

because it only effects LibEventLoop

These loops support more than stream based resources (e.g. socket resources) and this should also affect other loops that are edge triggered (haven't verified this yet).

As such, I'm unsure we can even address this here?

I think adding a warning to the README is probably what makes most sense as a first step 👍

from event-loop.

clue avatar clue commented on May 22, 2024

I think adding a warning to the README is probably what makes most sense as a first step 👍

This is everything that we can do here. Does anybody feel like filing a PR? 👍

from event-loop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.