-
Notifications
You must be signed in to change notification settings - Fork 32
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
php-fpm "oops, unknown child exited with 1" #68
Comments
@SunMar you should read that comment: #64 (comment) I'd recommend using the http client in a traditional application environment (synchronous). Otherwise use amp's |
@prolic I want to use this in an asynchronous, that doesn't mean though that it should continue forever. There comes a point when there is nothing left to do and at that point the script should finish, preferably gracefully and not via a forced shutdown. |
Note that the examples are just to show how the problem can be reproduced. It is not the full scope of the application. |
Just close the event store connection then. |
That is what I did initially, but that results in the same issue where the child process of Amphp is killed forcefully and then gives an alert in php-fpm. It could be that this is just something more in Amphp, but in the Amphp documentation I couldn't find anything except a Loop::stop() to finish. |
I don't get it, either you use it async or you have php-fpm running. FPM + async - does it makes sense? Not sure. |
Maybe you can provide a little more background of what you are trying to do. |
Well right now I'm mostly experimenting in getting the basics down on implementing your client and writing a new application from scratch using Event Sourcing. I'd like to create some projections that run as a service and that can subscribe to multiple event streams and/or subscriptions. Building that in an asynchronous way seemed to make sense to me. The reason why I'm (also) using PHP-FPM is because while I'm experimenting I wanted to keep it simple and not bother with multiple packages for communicating with EventStore right now. Doing things asynchronously with PHP-FPM indeed doesn't make sense. I might switch to a different package to handle writing events in the PHP-FPM part of the application, but I'm not sure yet. For now I'm modelling things in a way that I'm gathering all events and do one transactional write of all events at the end, so there will be only one EventStore connection per request at most. Then if I have to choose between one HTTP connection or one TCP connection, TCP is probably more efficient and less overhead. Regardless it's things I'm not sure yet about and still experimenting to figure out what the best solution is. In the end the PHP-FPM alert is only what uncovered the exit error status |
I don't know where this If you want to handle a traditional synchronous application, use event-store-http-client. You can still use the tcp client for async subscriptions (another process, cli script). If you want to have a async application as well, let the app run via cli as well and use https://github.com/amphp/http-server |
Yes I'll probably end up using the To be more specific about the Amphp thing, once you end the loop The child process is an
When
So the |
I'd suggest you ask that question on amps issue tracker. But tag me, I'm curious as well. |
Will do that, will try first to create a reproducible setup that doesn't use this library to make sure it really is an Amphp thing. |
Created amphp/socket#56 for this. The error appears on their example script as well so it's probably not something specific to this library. While creating a proper reproducible example I did notice however that this library is using outdated versions of
|
These are dependencies of the amp dependencies. For example amphp/socket requires amphp/dns to resolve dns names. amphp/http-server requires amphp/uri, etc. |
Yes, but I can create a PR for this as well, removing those dependencies, but I wanted to be sure they're really not used, because I determined the above list just by doing a search for all |
You're right. I probably added those in an early stage of development for some reason and forgot to clean up. |
PR would be welcome |
@SunMar prooph/event-store#354 might be interesting to you as well. |
Created PR #71 for the unused dependencies. Also I've looked at prooph before but got stuck on it and since it doesn't support EventStore (yet) I parked it as something to maybe look into later. Thank you for mentioning that PR, I'll track it and once it's merged revisit the prooph ES framework :). Also will close this ticket now since the original issue I opened it for is an Amphp thing and doesn't have anything to do with this library. Thank you for the assistance :). |
The event-store-client will simply rely on prooph/event-store v8 and some classes (f.e. |
Hi,
I've been playing around with this EventStore client a bit. I've tried various other HTTP and TCP clients (like FriendsOfOuro and Rxnet) but they all had problems that were a no-go for me (HTTP implementations have to do active polling which adds massive overhead and latency and RxPHP silently eats any exceptions thrown in an
onError
). So far I'm really liking this EventStore TCP, you've done an amazon job on it! :)One issue I've seen so far is though is that I'm constantly seeing the following in my PHP-FPM logs:
I've done some deep-dive debugging with XDebug and it looks like there's nothing actually going wrong. It's just that Amphp spawns a child process and the alert is caused by
Amp\Process\Internal\Posix\Runner->kill()
that gets called during destruction when the child process isn't needed anymore. This does aproc_terminate()
, which causes aChannelException
in theprocess-runner.php
child process which then does anexit(1)
. At that point the child process isn't actually doing anything any more though, so everything works and nothing is going wrong. It is however not a very nice alert to have scattered in the logs.I'm not very familiar with Amphp though, is this normal behavior, is
prooph/event-store-client
missing something so that Amphp can do a graceful shutdown of the child process instead of having to forcefully kill it, or am I implementing the client wrong?My two test implementations (that both have the same issue) are as follows:
To write to a stream:
Note that I have noticed that if I don't do a
$this->eventStore->close()
orLoop::stop()
, the process will get stuck in the event loop forever doing heartbeats. Is that expected behavior? I don't necessarily want to close the connection because if I need it again later it's a waste to have to re-open it, but I'm also not sure if doingLoop::stop()
is the right approach, since everything is done asynchronously I do want to make sure when the loop stops all events have been written to the stream and not risk stopping the loop before that has happened.And to read from a stream:
Note that the
Loop::stop()
here is just for debugging so I could check if in this case the child process would exit withexit(1)
as well and it does. The end goal of the subscription is of course to keep it running and not close the connection, so in this case I do want the Loop to continue running and waiting for new events, in this scenario it shouldn't stop.Hopefully you can shed some light on what's going on here, my guess is that I'm implementing the client wrong :). Thank you!
The text was updated successfully, but these errors were encountered: