NOT FOR MERGE: Demonstrate failures with heartbeats. - #60
Conversation
|
any progress on this? |
|
What is this PR about? What should it achieve? |
|
I thought it addresses some connection issues, but probably it doesn't. I will create an issue for that if I got more information. |
|
This is a demonstration that heartbeats cause it to think that there is data to read, and so get perpetually stuck gobbling data, rather than returning that there is no data to read. |
|
I ran into a similar issue with heartbeats disabled. There seems to be some PHP bugs which lead to problems when using https://bugs.php.net/bug.php?id=52602 |
|
@andrewbelcher sorry for the late response and thank you for the PR. That's right for the moment we don't support heartbeats. If we want to support heartbeats we must first think about different problems that we get with the beats. The main issue is timing. We would need to assure that the logic that is added on top on the client / around the read() or / send() is executed within a specific time - otherwise our code has no chance to check for a missed beat / sending a beat in time. I think we could just add another layer which would take care about reading and sending heartbeats. If we want to integrate it into the state machine we could add new states for this. But it should not be part of the default machine, as most clients don't take care about timing. (Correct me if you have seen other things out there.) When timing is something that is important, please consider to use https://github.com/reactphp. Here you get the power to declare that something must be executed within a specified interval. I'm not sure id the stomp extension for react is ready... see #69. @Fender123 so ActiveMQ shows the client as disconnected while the client is still running and processing data? What version is in use? |
|
Yes, so I wasn't trying to get heartbeat support, but rather demonstrate that if a server was sending a heartbeat it caused us to think there is a frame to read and get stuck gobbling data. See the linked issue where I was getting long periods with no feedback. I'm not certain heartbeats were the issue it was just one theory. |
|
@jmglsn let me explain the setting to you. stomp-php: 4.2.1 |
|
@andrewbelcher ok, I'll create a feature branch for this, so that we're able to receive them and make some checks on top on in - maybe this helps as start for tracing the actual issue. @Fender123, what ACK mode do you use? Can you try to configure it to client individual? |
|
@jmglsn I'm using auto ACK. I can test client individual ACK in the next days |
|
Just added a feature branch with a draft for sending heartbeats to the server. // It's important that the read timeout is lower than the beat interval.
$this->Stomp->setHeartbeat(0,500); // at least after 0.5 seconds we will let the server know that we're alive
$this->Stomp->getConnection()->setReadTimeout(0, 250000); // after 0.25 seconds a read operation must timeout
// we add a beat emitter to the observers of our connection
$this->Stomp->getConnection()->getObserver()->addObserver(new Emitter($this->Stomp->getConnection()));Now the |
- add observer based heartbeat emitter, which must be added to the connection if outgoing heartbeats are wanted - allow to use heartbeats when connection is reopened by server - fix older test cases to be more precise and fix preconditions
* add a basic heartbeat emitter that allows to send heartbeats (#60) - add observer based heartbeat emitter, which must be added to the connection if outgoing heartbeats are wanted - allow to use heartbeats when connection is reopened by server
|
Included in our latest release https://github.com/stomp-php/stomp-php/releases/tag/4.2.2 Thank you! |
No description provided.