Skip to content
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

Multiple Cro::HTTP::Client objects fetching the same URL, hangs often #166

Open
lizmat opened this issue Jan 4, 2022 · 2 comments
Open

Comments

@lizmat
Copy link
Member

lizmat commented Jan 4, 2022

use Cro::HTTP::Client;

my @clients = Cro::HTTP::Client.new xx 5;

for @clients -> $client {
    say "connecting";
    my $resp := await $client.get("https://updown.io/api/checks?api-key=ro-UME2wrpSpbNGbSuZMRH1");
    say "got headers, awaiting body";
    my $body := await $resp.body;
    say "got body";
}

For some reason, the above code seldom completes the request for all Cro::HTTP::Client objects. When it hangs, it hangs on "connecting". Typical output:

$ raku script
connecting
got headers, awaiting body
got body
connecting
^C   <--- that'd be me, tired of waiting
@jnthn
Copy link
Member

jnthn commented Jan 4, 2022

  1. CRO_TRACE=1 in the environment and send the output
  2. Does it happen if you have one client and re-use it?

@lizmat
Copy link
Member Author

lizmat commented Jan 4, 2022

2: no

1:

connecting
[TRACE(anon 1)] Cro::ConnectionConditional EMIT TCP Message
  50 52 49 20 2a 20 48 54 54 50 2f 32 2e 30 0d 0a  PRI * HTTP/2.0..
  0d 0a 53 4d 0d 0a 0d 0a                          ..SM....

[TRACE(anon 1)] Cro::ConnectionConditional EMIT TCP Message
  00 00 24 04 00 00 00 00 00 00 01 00 00 10 00 00  ..$.............
  02 00 00 00 00 00 03 00 00 00 64 00 04 00 00 ff  ..........d.....
  ff 00 05 00 00 40 00 00 06 00 00 03 e8           .....@.......

[TRACE(anon 1)] Cro::TLS::Connector EMIT TCP Message
  00 00 12 04 00 00 00 00 00 00 03 00 00 00 80 00  ................
  04 00 01 00 00 00 05 00 ff ff ff 00 00 04 08 00  ................
  00 00 00 00 7f ff 00 00                          ........

[TRACE(anon 1)] RequestSerializerExtension EMIT HTTP Request
  GET /api/checks?api-key=ro-UME2wrpSpbNGbSuZMRH1 HTTP/1.1
  Host: updown.io
  User-agent: Cro
[TRACE(anon 1)] Cro::TLS::Connector EMIT TCP Message
  00 00 00 04 01 00 00 00 00                       .........

[TRACE(anon 1)] Cro::ConnectionConditional EMIT TCP Message
  00 00 3f 01 05 00 00 00 01 41 09 75 70 64 6f 77  ..?......A.updow
  6e 2e 69 6f 82 87 44 2b 2f 61 70 69 2f 63 68 65  n.io..D+/api/che
  63 6b 73 3f 61 70 69 2d 6b 65 79 3d 72 6f 2d 55  cks?api-key=ro-U
  4d 45 32 77 72 70 53 70 62 4e 47 62 53 75 5a 4d  ME2wrpSpbNGbSuZM
  52 48 31 7a 03 43 72 6f                          RH1z.Cro

[TRACE(anon 1)] Cro::TLS::Connector EMIT TCP Message
  00 01 17 01 04 00 00 00 01 20 88 76 91 aa 63 55  ......... .v..cU
  e5 80 ae 16 97 02 9f d7 08 ed a9 36 ff 7f 61 96  ...........6..a.
  df 69 7e 94 03 4a 65 1d 4a 08 02 12 82 05 c1 3b  .i~..Je.J......;
  70 2d 29 8b 46 ff 5f 8b 1d 75 d0 62 0d 26 3d 4c  p-).F._..u.b.&=L
  74 41 ea 00 84 42 46 9b 51 85 10 00 a6 ac df 00  tA...BF.Q.......
  89 20 c9 39 56 21 ea 4d 87 a3 8e ae d8 e8 31 3e  . .9V!.M......1>
  94 a4 7e 56 1c c5 81 90 7f 00 04 76 61 72 79 8e  ..~V.......vary.
  fc 5a 1a cc b6 62 fa fa 53 55 86 98 d5 7f 00 91  .Z...b..SU......
  42 6c 31 12 b2 6c 1d 48 ac f6 25 64 14 96 d8 64  Bl1..l.H..%d...d
  fa 8c a4 7e 56 1c c5 81 c6 40 e8 80 00 7f 00 89  ...~V....@......
  f2 b5 85 ed 69 50 95 8d 27 99 2b e3 6d f7 09 2a  ....iP..'.+.m..*
  c2 28 9e 59 a1 05 a5 9f 1c 62 59 f0 01 f2 b4 50  .(.Y.....bY....P
  c6 f3 e2 00 83 2a 47 37 9b e4 c7 f2 d3 21 00 5f  .....*G7.....!._
  69 f7 de 65 e2 4a 47 1a 7c 72 c8 37 c4 e3 a2 90  i..e.JG.|r.7....
  81 96 3f e7 00 87 f2 b5 96 d4 93 52 5f 86 02 e1  ..?........R_...
  03 2e 09 ff 00 89 f2 b5 67 f0 5b 0b 22 d1 fa 90  ........g.[."...
  d7 3d a8 31 ea 53 58 d0 82 d5 31 6c fe b6 ff 7f  .=.1.SX...1l....
  00 8a f2 b5 76 1f cf a5 88 32 4e 5f 03 48 49 54  ....v....2N_.HIT
  00 1f 6b 00 01 00 00 00 01 5b 7b 22 74 6f 6b 65  ..k......[{"toke
  6e 22 3a 22 78 79 72 38 22 2c 22 75 72 6c 22 3a  n":"xyr8","url":
  22 68 74 74 70 73 3a 2f 2f 63 72 6f 2e 73 65 72  "https://cro.ser
  76 69 63 65 73 2f 22 2c 22 61 6c 69 61 73 22 3a  vices/","alias":
  22 43 72 6f 20 53 65 72 76 69 63 65 73 20 48 6f  "Cro Services Ho
  6d 65 22 2c 22 6c 61 73 74 5f 73 74 61 74 75 73  me","last_status
  22 3a 32 30 30 2c 22 75 70 74 69 6d 65 22 3a 31  ":200,"uptime":1
  30 30 2e 30 2c 22 64 6f 77 6e 22 3a 66 61 6c 73  00.0,"down":fals
  65 2c 22 64 6f 77 6e 5f 73 69 6e 63 65 22 3a 6e  e,"down_since":n
  75 6c 6c 2c 22 65 72 72 6f 72 22 3a 6e 75 6c 6c  ull,"error":null
  2c 22 70 65 72 69 6f 64 22 3a 36 30 2c 22 61 70  ,"period":60,"ap
  64 65 78 5f 74 22 3a 31 2e 30 2c 22 73 74 72 69  dex_t":1.0,"stri
  6e 67 5f 6d 61 74 63 68 22 3a 22 22 2c 22 65 6e  ng_match":"","en
  61 62 6c 65 64 22 3a 74 72 75 65 2c 22 70 75 62  abled":true,"pub
  6c 69 73 68 65 64 22 3a 74 72 75 65 2c 22 64 69  lished":true,"di
  [7828 bytes not displayed]

[TRACE(anon 1)] Cro::ConnectionConditional EMIT HTTP Response
  HTTP/1.1 200 OK
  server: nginx/1.14.0 (Ubuntu)
  date: Tue, 04 Jan 2022 20:27:14 GMT
  content-type: application/json
  status: 200 OK
  cache-control: public, max-age=30
  vary: X-Api-Key, Origin
  strict-transport-security: max-age=63072000
  x-request-id: e9a596cf-2e28-4214-9ab2-9009e4e1b892
  etag: W/"431019499838cfc649afda92672dc1fb"
  x-runtime: 0.103629
  x-powered-by: Phusion Passenger(R)
  x-proxy-cache: HIT
[TRACE(anon 1)] ResponseParserExtension EMIT HTTP Response
  HTTP/1.1 200 OK
  server: nginx/1.14.0 (Ubuntu)
  date: Tue, 04 Jan 2022 20:27:14 GMT
  content-type: application/json
  status: 200 OK
  cache-control: public, max-age=30
  vary: X-Api-Key, Origin
  strict-transport-security: max-age=63072000
  x-request-id: e9a596cf-2e28-4214-9ab2-9009e4e1b892
  etag: W/"431019499838cfc649afda92672dc1fb"
  x-runtime: 0.103629
  x-powered-by: Phusion Passenger(R)
  x-proxy-cache: HIT
got headers, awaiting body
got body
connecting
[TRACE(anon 2)] Cro::ConnectionConditional EMIT TCP Message
  50 52 49 20 2a 20 48 54 54 50 2f 32 2e 30 0d 0a  PRI * HTTP/2.0..
  0d 0a 53 4d 0d 0a 0d 0a                          ..SM....

[TRACE(anon 2)] Cro::ConnectionConditional EMIT TCP Message
  00 00 24 04 00 00 00 00 00 00 01 00 00 10 00 00  ..$.............
  02 00 00 00 00 00 03 00 00 00 64 00 04 00 00 ff  ..........d.....
  ff 00 05 00 00 40 00 00 06 00 00 03 e8           .....@.......

[TRACE(anon 2)] Cro::TLS::Connector EMIT TCP Message
  00 00 12 04 00 00 00 00 00 00 03 00 00 00 80 00  ................
  04 00 01 00 00 00 05 00 ff ff ff 00 00 04 08 00  ................
  00 00 00 00 7f ff 00 00                          ........

^C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants