Timeout http-keep-alive doesn't work

haproxy version: 2.0.17
We found the client received some 504 errors, less than 1/10000. Thus, we take a tcpdump and follow the stream, found that when haproxy completes a request, it does not disconnect to client after more than 40s (timeout http-keep-alive is 20s), and accepted a new request in this connection, and then quickly returned a 504 error to client. We tracked the problem request and found that haproxy has routed the request to the server, but quickly sent a RST to the server to disconnect.
I have two question:
1、In connection clinet to haproxy,Why not haproxy disconnect even if it times out?
2、In connection haproxy to server, why does haproxy sent RST quickly?
picture 1(client to haproxy, .193 is client and .135 is ha)

picture 2(haproxy to server, .135 is ha and .184 is server)

cfg:

global
    maxconn 25000
    maxconnrate 3000
    log 127.0.0.1 local1 err
    daemon
    pidfile /var/run/haproxy.pid
    nbproc 1
    noreuseport
    stats socket /var/run/haproxy.sock mode 666 level admin
    server-state-file /var/run/server_state
    spread-checks 20

defaults
    maxconn 25000
    log global
    option httplog
    option dontlognull
    timeout client 30s
    timeout server 30s
    timeout connect 5s
    option redispatch
    retries 2
    option http-keep-alive
    timeout http-keep-alive 20s
    http-reuse safe
    balance leastconn
    option accept-invalid-http-request
    option accept-invalid-http-response
    load-server-state-from-file global
    no option http-use-htx

listen MONITOR
    mode http
    bind 0.0.0.0:12345
    stats refresh 30s
    stats uri /haproxy_stats
    stats realm Haproxy\ Statistics
    stats auth test:test
    stats hide-version
    monitor-uri /haproxy_healthcheck

frontend VS_12633
    bind 0.0.0.0:12633
    bind [::]:12633 v6only
    mode http
    monitor-uri /haproxy_healthcheck
    use_backend %[path, map_beg(/etc/haproxy/conf/VS_12633. map)] if { path, map_beg(/etc/haproxy/conf/VS_12633. map) -m found }

backend BE_WEB1
    mode http
    balance leastconn
    timeout server 30s
    option forwardfor except 127.0.0.1 if-none
    option httpchk GET /test/Check.html
    http-check expect string check_ok
    server srv1 123.45.67.181:80 check inter 4000 rise 3 fall 3
    server srv2 123.45.67.182:80 check inter 4000 rise 3 fall 3

backend BE_WEB2
    mode http
    balance leastconn
    timeout server 30s
    option forwardfor except 127.0.0.1 if-none
    option httpchk GET /test/Check.html
    http-check expect string check_ok
    server srv3 123.45.67.183:80 check inter 4000 rise 3 fall 3
    server srv4 123.45.67.184:80 check inter 4000 rise 3 fall 3
    server srv5 123.45.67.185:80 check inter 4000 rise 3 fall 3