fix: prevent fwrite be stuck by large streams - #111
Conversation
|
Great!. Thank you @jmglsn ! |
|
@ganeko could you elaborate on the fix please? |
|
Hi @gabrielspiteri-highlight , Since 4.4.3 version you are able to set, on execution time, a custom connection's read/write max bytes, based on your custom stack. You can check this PR, #113 |
|
@ganeko I see but I don't understand how does this address the problem when fread() returns an empty string? |
|
@gabrielspiteri-highlight fread can return empty string because OpenSSL issue, not directly related to this library. If you let this library throw a exception, you will see the exception from OpenSSL. General speaking, you can get a SSL_ERROR_WANT_WRITE or SSL_ERROR_WANT_READ error. Only for debug purpose, you can remove |
|
@ganeko Removing the @ suppression ... code still moves along and simple returns an empty string. Any further info about which OpenSSL issue you refer to? |
|
@gabrielspiteri-highlight I don't know your current stack but the problem you report comes from OpenSSL or related protocol. Maybe reducing write length will help you. I debugged my problem logging fread warning as I said. |
|
@ganeko in my case messages are written to the queue by another system ... you mean it could be possible that the other system is not writing these messages properly? |
|
@gabrielspiteri-highlight this will be one reason, yes. |
|
@ganeko i believe I managed to work around this with using version 4.3.1 for stomp-php/stomp-php |
|
@gabrielspiteri-highlight as already mentioned, please feel free to open a new issue including more details about the problem that you face, this will simplify the support or possible bugfixing. Rolling back to an old version is not a good idea in a long term scenario. |
Under some systems, writing entire large message will cause process block. In this case, fwrite returns 0 and method throws
Was not possible to write frame! Write operation timed out.exception.Splitting message into smaller chunks will prevent this behavior.
Warning returned by actual
writeDatamethod:Tested under: