stomp-php icon indicating copy to clipboard operation
stomp-php copied to clipboard

Client not handling disconnections on write

Open ejsmont-artur opened this issue 13 years ago • 6 comments
trafficstars

Hi there

Sorry for so many bad news :) Another use case is when server disconnects after connection is established and before message is sent.

I create a loop of 100K messages to be sent and right after i kick it off i kill the server. Client dies with a stack smash:

PHP Fatal error:  Maximum function nesting level of '100' reached, aborting! in /home/aejsmont/svn/hacks/stomp/Stomp.php on line 599
PHP Stack trace:
PHP   1. {main}() /home/aejsmont/svn/hacks/stomp/topicSenderLoop.php:0
PHP   2. Stomp->send() /home/aejsmont/svn/hacks/stomp/topicSenderLoop.php:32
PHP   3. Stomp->_writeFrame() /home/aejsmont/svn/hacks/stomp/Stomp.php:256
PHP   4. Stomp->_reconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:497
PHP   5. Stomp->connect() /home/aejsmont/svn/hacks/stomp/Stomp.php:599
PHP   6. Stomp->_makeConnection() /home/aejsmont/svn/hacks/stomp/Stomp.php:190
PHP   7. Stomp->disconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:140
PHP   8. Stomp->_writeFrame() /home/aejsmont/svn/hacks/stomp/Stomp.php:472
PHP   9. Stomp->_reconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:497
PHP  10. Stomp->connect() /home/aejsmont/svn/hacks/stomp/Stomp.php:599
PHP  11. Stomp->_makeConnection() /home/aejsmont/svn/hacks/stomp/Stomp.php:190
PHP  12. Stomp->disconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:140
PHP  13. Stomp->_writeFrame() /home/aejsmont/svn/hacks/stomp/Stomp.php:472
PHP  14. Stomp->_reconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:497
PHP  15. Stomp->connect() /home/aejsmont/svn/hacks/stomp/Stomp.php:599
PHP  16. Stomp->_makeConnection() /home/aejsmont/svn/hacks/stomp/Stomp.php:190
PHP  17. Stomp->disconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:140
PHP  18. Stomp->_writeFrame() /home/aejsmont/svn/hacks/stomp/Stomp.php:472
PHP  19. Stomp->_reconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:497
PHP  20. Stomp->connect() /home/aejsmont/svn/hacks/stomp/Stomp.php:599
PHP  21. Stomp->_makeConnection() /home/aejsmont/svn/hacks/stomp/Stomp.php:190
PHP  22. Stomp->disconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:140
PHP  23. Stomp->_writeFrame() /home/aejsmont/svn/hacks/stomp/Stomp.php:472
PHP  24. Stomp->_reconnect() /home/aejsmont/svn/hacks/stomp/Stomp.php:497
PHP  25. Stomp->connect() /home/aejsmont/svn/hacks/stomp/Stomp.php:599
PHP  26. Stomp->_makeConnection() /home/aejsmont/svn/hacks/stomp/Stomp.php:190

Thanks

Art

ejsmont-artur avatar Jul 16 '12 11:07 ejsmont-artur

Do you have any suggestions on how you'd add buffering messages that need to be sent post-reconnection?

marklr avatar Jul 16 '12 14:07 marklr

Well I did not even expect to have this in place. I thought throwing exception and flagging connection as lost would do so that client of the lib could decide what to do :)

I guess reconnection count could be a custom param as next step.

Thanks On Jul 17, 2012 12:47 AM, "marklr" < [email protected]> wrote:

Do you have any suggestions on how you'd add buffering messages that need to be sent post-reconnection?


Reply to this email directly or view it on GitHub: https://github.com/dejanb/stomp-php/issues/12#issuecomment-7008049

ejsmont-artur avatar Jul 17 '12 00:07 ejsmont-artur

I think the optimal solution would be to buffer (in _writeFrame()) and if we pass a threshold of failed reconnects, then throw an exception. Otherwise, just dump it all once we're reconnected.

marklr avatar Jul 17 '12 07:07 marklr

I've encountered the same problem when trying to test failover except in my case it locked up my ubuntu machine and I had to hard boot it. Might want to add a delay before trying to reconnect ;)

abrown28 avatar May 23 '13 15:05 abrown28

any idea if you are going to fix this? Issue was raised 11 months ago.

abrown28 avatar Jun 12 '13 15:06 abrown28

Yes I like to but I´m out of time and have no running project where I use the client at the moment. So my afford to fix this is not this big. But If you provide me some testcode to reproduce the error I can take a look. But I won´t promise a solution in the near future.

monofone avatar Jun 13 '13 07:06 monofone