-
Notifications
You must be signed in to change notification settings - Fork 272
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
balancer by lua block: Getting errors : attempt to send data on a closed socket #48
Comments
@rohitjoshi Will you please provide a minimal and standalone example that we can easily reproduce the issue on our side? |
@rohitjoshi BTW, it's a bad idea to parse a JSON string in your |
@rohitjoshi For the minimal example that can reproduce the issue, I don't think you need the JSON part or the branching code testing the size of the server array (you can just use a static table, or even a static host and port pair). |
@rohitjoshi And for the standalone part of the example, you need to provide your |
@rohitjoshi Please see the test suite for https://github.com/openresty/lua-resty-core/blob/master/t/balancer.t |
@rohitjoshi I've just had a closer look and I don't think that error is trigger by the The error message is generated in your cosocket related Lua code when you try continuing using a cosocket object after a fatal error has happened in a previous cosocket operation. How to fix:
lua_socket_log_errors off; |
@rohitjoshi A fatal error in a cosocket operation closes the underlying socket immediately. So when you go ahead and try sending data on this closed socket without re-connecting, you get the error log message "attempt to send data on a closed socket" from the cosocket object when your do not turn off |
@agentzh thanks. Yes, errors seem to be due to upstream simulator server closing the connection. I did not see errors reflected in my client (wrk). I ran performance test using two scenarios using wrk.
Based on the I ran 3 tests with body size 100, 500 and 1000.
Both test are returning almost identical results with nginx upstream has slightly lower latency and higher throughput. May be due to my code where I am converting string to table using msgpack. (I replaced json with msgpack). Will optimize this. By the way, I did not see any Thanks again. |
Setting |
…_name and host arg of balancer.set_current_peer at the same time. (#48)
Hello,
I am running a performance test using balancer by lua block module. Periodically, I am seeing following errors.
My code:
The text was updated successfully, but these errors were encountered: