asyncer-io / r2dbc-mysql

Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).
https://r2dbc.io
Apache License 2.0
206 stars 21 forks source link

This MySQL driver may cause my request to wait at least 20 seconds #114

Closed JohnNiang closed 1 year ago

JohnNiang commented 1 year ago

Describe the bug

Recently, I was trying to integrate R2DBC MySQL driver io.asyncer:r2dbc-mysql, but I found the problem about pending some requests randomly and at least 20 seconds.

This only happened after replacing another R2DBC MySQL driver com.github.jasync-sql:jasync-r2dbc-mysql. It was the first time I saw the weird behavior. I had no idea what happened.

To Reproduce

  1. Please checkout PR https://github.com/halo-dev/halo/pull/3918.

  2. After starting the application, please open browser devtools, and try to make some requests and view the networks. You will see some pending requests.

Expected behavior

All requests should be respond quickly instead of stalling 20s.

Screenshots

image image
jchrys commented 1 year ago

Hello, @JohnNiang. Thank you so much for your valuable report. I will attempt to reproduce the issue in my environment and investigate the root cause. I appreciate your patience and understanding as we work towards resolving this.

JohnNiang commented 1 year ago

Below are TCP detail after I request an endpoint which will be stalled:

No. Time Source Destination Protocol Length Info
581 4.846844 ::1 ::1 TCP 64 54434 → 8090 [ACK] Seq=1 Ack=1 Win=4464 Len=0
582 4.846870 ::1 ::1 TCP 64 54431 → 8090 [ACK] Seq=1 Ack=1 Win=5067 Len=0
583 4.846929 ::1 ::1 TCP 76 [TCP ACKed unseen segment] 8090 → 54434 [ACK] Seq=1 Ack=2 Win=6029 Len=0 TSval=1682582965 TSecr=2464061572
584 4.846943 ::1 ::1 TCP 76 [TCP ACKed unseen segment] 8090 → 54431 [ACK] Seq=1 Ack=2 Win=5921 Len=0 TSval=1501111373 TSecr=3028977434
831 7.036871 ::1 ::1 TCP 64 54435 → 8090 [ACK] Seq=1 Ack=1 Win=5831 Len=0
832 7.036896 ::1 ::1 TCP 64 54432 → 8090 [ACK] Seq=1 Ack=1 Win=5836 Len=0
833 7.036996 ::1 ::1 TCP 76 [TCP ACKed unseen segment] 8090 → 54435 [ACK] Seq=1 Ack=2 Win=6103 Len=0 TSval=4171232215 TSecr=939657388
834 7.037011 ::1 ::1 TCP 76 [TCP ACKed unseen segment] 8090 → 54432 [ACK] Seq=1 Ack=2 Win=5900 Len=0 TSval=2431891429 TSecr=68579578
867 7.440924 ::1 ::1 TCP 64 54433 → 8090 [ACK] Seq=1 Ack=1 Win=5028 Len=0
871 7.441021 ::1 ::1 TCP 76 [TCP ACKed unseen segment] 8090 → 54433 [ACK] Seq=1 Ack=2 Win=6233 Len=0 TSval=2332719529 TSecr=3151885012
1873 16.575992 ::1 ::1 TCP 64 54436 → 8090 [ACK] Seq=1 Ack=1 Win=6043 Len=0
1874 16.576018 ::1 ::1 TCP 76 [TCP ACKed unseen segment] 8090 → 54436 [ACK] Seq=1 Ack=2 Win=6237 Len=0 TSval=3671292214 TSecr=2991133698
2745 24.251035 ::1 ::1 HTTP 972 [TCP Previous segment not captured] GET /apis/content.halo.run/v1alpha1/tags?page=0&size=0 HTTP/1.1
2746 24.251113 ::1 ::1 TCP 76 [TCP ACKed unseen segment] 8090 → 54436 [ACK] Seq=1 Ack=898 Win=6223 Len=0 TSval=3671299890 TSecr=2991186374
2787 24.302558 ::1 ::1 HTTP/JSON 965 HTTP/1.1 200 OK , JavaScript Object Notation (application/json)
2788 24.302614 ::1 ::1 TCP 76 54436 → 8090 [ACK] Seq=898 Ack=890 Win=6029 Len=0 TSval=2991186425 TSecr=3671299941
jchrys commented 1 year ago

PTAL @mobidick1969

jchrys commented 1 year ago

I have identified the root cause of the bug, and it will be fixed in the next version.

jchrys commented 1 year ago

119 resolves this issue