haproxy/src
Willy Tarreau 9cca8dfc0b BUG/MINOR: mux-pt: do not pretend there's more data after a read0
Commit 8706c8131 ("BUG/MEDIUM: mux_pt: Always set CS_FL_RCV_MORE.")
was a bit excessive in setting this flag, it refrained from removing
it after read0 unless it was on an empty call. The problem it causes
is that read0 is thus ignored on the first call :

  $ strace -tts200 -e trace=recvfrom,epoll_wait,sendto  ./haproxy -db -f tcp.cfg
  06:34:23.956897 recvfrom(9, "blah\n", 15360, 0, NULL, NULL) = 5
  06:34:23.956938 recvfrom(9, "", 15355, 0, NULL, NULL) = 0
  06:34:23.956958 recvfrom(9, "", 15355, 0, NULL, NULL) = 0
  06:34:23.957033 sendto(8, "blah\n", 5, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 5
  06:34:23.957229 epoll_wait(3, [{EPOLLIN|EPOLLHUP|EPOLLRDHUP, {u32=8, u64=8}}], 200, 0) = 1
  06:34:23.957297 recvfrom(8, "", 15360, 0, NULL, NULL) = 0

If CO_FL_SOCK_RD_SH is reported by the transport layer, it indicates the
read0 was already seen thus we must not try again and we must immedaitely
report it. The simple fix consists in removing the test on ret==0 :

  $ strace -tts200 -e trace=recvfrom,epoll_wait,sendto  ./haproxy -db -f tcp.cfg
  06:44:21.634835 recvfrom(9, "blah\n", 15360, 0, NULL, NULL) = 5
  06:44:21.635020 recvfrom(9, "", 15355, 0, NULL, NULL) = 0
  06:44:21.635056 sendto(8, "blah\n", 5, MSG_DONTWAIT|MSG_NOSIGNAL, NULL, 0) = 5
  06:44:21.635269 epoll_wait(3, [{EPOLLIN|EPOLLHUP|EPOLLRDHUP, {u32=8, u64=8}}], 200, 0) = 1
  06:44:21.635330 recvfrom(8, "", 15360, 0, NULL, NULL) = 0

The issue is minor, it only results in extra syscalls and CPU usage.
This fix should be backported to 2.0 and 1.9.
2019-07-15 06:47:54 +02:00
..
51d.c BUILD/MINOR: 51d: Updated build registration output to indicate thatif the library is a dummy one or not. 2019-06-13 18:00:54 +02:00
acl.c BUG/MINOR: acl: properly detect pattern type SMP_T_ADDR 2019-04-19 11:45:20 +02:00
action.c MINOR: stick-tables: Add peers process binding computing. 2019-05-07 06:54:07 +02:00
activity.c MINOR: activity: enable automatic profiling turn on/off 2019-04-25 17:26:46 +02:00
applet.c MEDIUM: appctx/debug: force a crash if an appctx spins over itself forever 2019-04-26 13:15:56 +02:00
arg.c MEDIUM: tools: improve time format error detection 2019-06-07 19:32:02 +02:00
auth.c CLEANUP: build: rename some build macros to use the USE_* ones 2019-05-22 19:47:57 +02:00
backend.c BUG/MEDIUM: servers: Don't forget to set srv_cs to NULL if we can't reuse it. 2019-07-08 16:32:58 +02:00
base64.c BUG/MINOR: base64: dec func ignores padding for output size checking 2019-01-14 19:32:15 +01:00
buffer.c MEDIUM: memory: use pool_destroy_all() to destroy all pools on deinit() 2018-11-26 19:50:32 +01:00
cache.c BUG/MINOR: cache/htx: Fix the counting of data already sent by the cache applet 2019-06-11 14:05:25 +02:00
cfgparse-global.c MEDIUM: tools: improve time format error detection 2019-06-07 19:32:02 +02:00
cfgparse-listen.c MEDIUM: Make 'redispatch' directive fatal 2019-06-17 13:35:54 +02:00
cfgparse.c MEDIUM: tools: improve time format error detection 2019-06-07 19:32:02 +02:00
channel.c MINOR: channel: Add the function channel_add_input 2019-01-02 20:12:44 +01:00
checks.c BUG/MEDIUM: checks: Don't attempt to read if we destroyed the connection. 2019-07-10 16:29:12 +02:00
chunk.c Revert "MINOR: chunks: Make sure trash_size is only set once." 2019-06-07 15:37:47 +02:00
cli.c BUG/MINOR: mworker/cli: don't output a \n before the response 2019-07-01 15:34:11 +02:00
compression.c MINOR: time: move the cpu, mono, and idle time to thread_info 2019-05-20 21:14:14 +02:00
connection.c CLEANUP: connection: rename the wait_event.task field to .tasklet 2019-06-14 14:42:29 +02:00
da.c BUG/MEDIUM: da: cast the chunk to string. 2019-07-11 10:20:09 +02:00
debug.c BUILD: Silence gcc warning about unused return value 2019-06-13 15:47:41 +02:00
dict.c BUG/MINOR: dict: race condition fix when inserting dictionary entries. 2019-06-11 09:54:12 +02:00
dns.c MINOR: action: new '(http-request|tcp-request content) do-resolve' action 2019-04-23 11:41:52 +02:00
ev_epoll.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_evports.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_kqueue.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_poll.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
ev_select.c MEDIUM: poller: separate the wait time from the wake events 2019-05-28 17:25:21 +02:00
fd.c BUG/MEDIUM: threads: fix double-word CAS on non-optimized 32-bit platforms 2019-05-27 17:40:59 +02:00
filters.c BUG/MEDIUM: htx: Don't change position of the first block during HTX analysis 2019-06-14 11:13:32 +02:00
flt_http_comp.c BUG/MEDIUM: compression: Set Vary: Accept-Encoding for compressed responses 2019-06-17 18:51:43 +02:00
flt_spoe.c BUG/MINOR: spoe: Fix memory leak if failing to allocate memory 2019-06-24 14:38:15 +02:00
flt_trace.c BUG/MINOR: fl_trace/htx: Be sure to always forward trailers and EOM 2019-06-14 11:13:32 +02:00
freq_ctr.c BUG/MAJOR: threads/freq_ctr: use a memory barrier to detect changes 2017-10-31 18:01:18 +01:00
frontend.c MEDIUM: init: convert all trivial registration calls to initcalls 2018-11-26 19:50:32 +01:00
h1.c MEDIUM: h1: Add an option to sanitize connection headers during parsing 2019-04-12 22:06:53 +02:00
h2.c BUG/MEDIUM: htx: Fully update HTX message when the block value is changed 2019-06-18 10:02:05 +02:00
haproxy.c BUG/MEDIUM: mworker: don't call the thread and fdtab deinit 2019-06-24 17:54:05 +02:00
hash.c MINOR: hash: add new function hash_crc32c 2018-03-21 05:04:01 +01:00
hathreads.c MEDIUM: threads: add thread_sync_release() to synchronize steps 2019-06-10 09:42:43 +02:00
hdr_idx.c CLEANUP: pools: rename all pool functions and pointers to remove this "2" 2017-11-24 17:49:53 +01:00
hlua.c BUG/MEDIUM: http/applet: Finish request processing when a service is registered 2019-07-05 14:26:14 +02:00
hlua_fcn.c MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct 2019-05-07 06:58:15 +02:00
hpack-dec.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
hpack-enc.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
hpack-huff.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
hpack-tbl.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
http.c MINOR: http: turn default error files to HTTP/1.1 2019-06-11 16:37:13 +02:00
http_acl.c MEDIUM: init: convert all trivial registration calls to initcalls 2018-11-26 19:50:32 +01:00
http_act.c BUG/MEDIUM: http/applet: Finish request processing when a service is registered 2019-07-05 14:26:14 +02:00
http_conv.c MEDIUM: init: convert all trivial registration calls to initcalls 2018-11-26 19:50:32 +01:00
http_fetch.c BUG/MINOR: http: Use the global value to limit the number of parsed headers 2019-06-14 11:13:32 +02:00
http_htx.c BUG/MEDIUM: proto_htx: Don't add EOM on 1xx informational messages 2019-06-26 15:23:06 +02:00
http_msg.c BUG/MEDIUM: http: Use pointer to the begining of input to parse message headers 2019-05-10 11:47:00 +02:00
http_rules.c BUG/MINOR: http-rules: mention "deny_status" for "deny" in the error message 2019-06-11 16:37:13 +02:00
htx.c BUG/MINOR: htx: Save hdrs_bytes when the HTX start-line is replaced 2019-06-26 09:57:49 +02:00
i386-linux-vsys.c MEDIUM: listener: add support for linux's accept4() syscall 2012-10-08 20:11:03 +02:00
lb_chash.c MINOR: backend: move hash_balance_factor out of chash 2019-01-14 19:33:17 +01:00
lb_fas.c BUG/MEDIUM: lb_fas: Don't test the server's lb_tree from outside the lock 2019-07-05 14:26:15 +02:00
lb_fwlc.c BUG/MEDIUM: lb_fwlc: Don't test the server's lb_tree from outside the lock 2019-06-19 13:55:57 +02:00
lb_fwrr.c BUG/MAJOR: lb/threads: make sure the avoided server is not full on second pass 2019-05-27 10:29:59 +02:00
lb_map.c MEDIUM: lb/threads: Use the new _HA_ATOMIC_* macros. 2019-03-11 17:02:38 +01:00
listener.c BUG/MAJOR: listener: fix thread safety in resume_listener() 2019-07-12 09:07:48 +02:00
log.c BUG/MINOR: log: Detect missing sampling ranges in config 2019-06-26 11:15:49 +02:00
lru.c MINOR: lru: new function to delete <nb> least recently used keys 2016-01-11 07:31:35 +01:00
mailers.c MEDIUM: Add parsing of mailers section 2015-02-03 00:24:16 +01:00
map.c BUG/MEDIUM: maps: only try to parse the default value when it's present 2019-04-19 11:35:22 +02:00
memory.c MINOR: pools: always pre-initialize allocated memory outside of the lock 2019-07-09 10:40:33 +02:00
mux_h1.c BUG/MINOR: mux-h1: Correctly report Ti timer when HTX and keepalives are used 2019-07-12 16:14:12 +02:00
mux_h2.c BUG/MEDIUM: mux-h2: Remove the padding length when a DATA frame size is checked 2019-06-19 10:06:31 +02:00
mux_pt.c BUG/MINOR: mux-pt: do not pretend there's more data after a read0 2019-07-15 06:47:54 +02:00
mworker-prog.c BUG/MINOR: mworker-prog: Fix segmentation fault during cfgparse 2019-06-24 10:09:00 +02:00
mworker.c BUILD: mworker: silence two printf format warnings around getpid() 2019-06-22 07:57:56 +02:00
namespace.c MINOR: initcall: apply initcall to all register_build_opts() calls 2018-11-26 19:50:32 +01:00
pattern.c BUILD: pattern: work around an internal compiler bug in gcc-3.4 2019-06-16 18:40:33 +02:00
payload.c MINOR: htx: Remove the macro IS_HTX_SMP() and always use IS_HTX_STRM() instead 2019-05-28 07:42:12 +02:00
peers.c MINOR: peers: Optimization for dictionary cache lookup. 2019-06-07 15:47:54 +02:00
pipe.c BUILD: address a few cases of "static <type> inline foo()" 2019-04-15 21:55:48 +02:00
proto_http.c BUG/MEDIUM: http/applet: Finish request processing when a service is registered 2019-07-05 14:26:14 +02:00
proto_htx.c BUG/MEDIUM: streams: Don't redispatch with L7 retries if redispatch isn't set. 2019-07-12 16:17:50 +02:00
proto_sockpair.c MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02:00
proto_tcp.c CLEANUP: proto_tcp: Remove useless header inclusions. 2019-07-11 10:40:20 +02:00
proto_udp.c CLEANUP: fix inconsistency between fd->iocb, proto->accept and accept() 2016-04-14 11:18:22 +02:00
proto_uxst.c MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02:00
protocol.c MEDIUM: protocol: use a custom AF_MAX to help protocol parser 2018-09-12 07:12:27 +02:00
proxy.c BUG/MEDIUM: connections: Make sure we're unsubscribe before upgrading the mux. 2019-07-03 13:57:30 +02:00
queue.c BUG/MEDIUM: queue: fix the tree walk in pendconn_redistribute. 2019-05-27 10:29:59 +02:00
raw_sock.c MEDIUM: connections: Remove CONN_FL_SOCK* 2019-06-05 18:03:38 +02:00
regex.c MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct 2019-05-07 06:58:15 +02:00
sample.c BUG/MAJOR: sample: Wrong stick-table name parsing in "if/unless" ACL condition. 2019-06-21 09:48:28 +02:00
server.c BUG/MEDIUM: servers: Fix a race condition with idle connections. 2019-07-11 16:16:38 +02:00
session.c MEDIUM: connections: Introduce a handshake pseudo-XPRT. 2019-06-05 18:03:38 +02:00
sha1.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
shctx.c CLEANUP: Fix typos in the shctx subsystem 2018-12-02 18:40:29 +01:00
signal.c CLEANUP: Fix a typo in the signal subsystem 2018-12-02 18:39:52 +01:00
ssl_sock.c BUG/MINOR: ssl: revert empty handshake detection in OpenSSL <= 1.0.2 2019-07-09 04:47:18 +02:00
standard.c BUILD: tools: work around an internal compiler bug in gcc-3.4 2019-06-16 18:16:33 +02:00
stats.c MINOR: htx: Don't use end-of-data blocks anymore 2019-06-05 10:12:11 +02:00
stick_table.c MEDIUM: tools: improve time format error detection 2019-06-07 19:32:02 +02:00
stream.c BUG/MEDIUM: streams: Don't redispatch with L7 retries if redispatch isn't set. 2019-07-12 16:17:50 +02:00
stream_interface.c BUG/MEDIUM: stream-int: Don't rely on CF_WRITE_PARTIAL to unblock opposite si 2019-07-05 14:26:15 +02:00
task.c MINOR: task: introduce work lists 2019-07-12 09:07:48 +02:00
tcp_rules.c MINOR: action: Add the return code ACT_RET_DONE for actions 2019-07-05 14:26:14 +02:00
time.c BUG/MINOR: time: make sure only one thread sets global_now at boot 2019-06-06 16:50:39 +02:00
trace.c CONTRIB: trace: try to display the function's return value on exit 2017-10-24 19:54:25 +02:00
uri_auth.c CLEANUP: log: Rename Alert/Warning in ha_alert/ha_warning 2017-11-24 17:19:12 +01:00
vars.c BUG/MEDIUM: vars: make the tcp/http unset-var() action support conditions 2019-06-04 16:48:15 +02:00
version.c BUILD: add a new file "version.c" to carry version updates 2019-01-04 18:20:32 +01:00
wdt.c BUILD: watchdog: condition it to USE_RT 2019-05-23 10:20:55 +02:00
wurfl.c MINOR: WURFL: do not emit warnings when not configured 2019-05-22 14:01:22 +02:00
xprt_handshake.c CLEANUP: connection: rename the wait_event.task field to .tasklet 2019-06-14 14:42:29 +02:00
xxhash.c BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00