dejanb / stomp-php

Stomp PHP Client
http://stomp.fusesource.org/documentation/php/
93 stars 46 forks source link

Client not handling disconnections on write #12

Open ejsmont-artur opened 12 years ago

ejsmont-artur commented 12 years ago

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

marklr commented 12 years ago

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

ejsmont-artur commented 12 years ago

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" < reply@reply.github.com> 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

marklr commented 12 years ago

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.

abrown28 commented 11 years ago

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 commented 11 years ago

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

monofone commented 11 years ago

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.