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

Connection enters bad state #92

Open
floitsch opened this issue Apr 19, 2023 · 2 comments
Open

Connection enters bad state #92

floitsch opened this issue Apr 19, 2023 · 2 comments

Comments

@floitsch
Copy link
Member

With alpha.75, and http v2.1.
At some point my connection seems to have had an issue:

******************************************************************************
EXCEPTION error. 
DEADLINE_EXCEEDED
  0: __Monitor__.await         <sdk>/core/monitor_impl_.toit:28:20
  1: ResourceState_.wait_for_state_ <sdk>/core/events_.toit:55:5
  2: ResourceState_.wait_for_state.<block> <sdk>/core/events_.toit:19:12
  3: __Monitor__.locked_.<block> <sdk>/core/monitor_impl_.toit:123:12
  4: __Monitor__.locked_       <sdk>/core/monitor_impl_.toit:95:3
  5: ResourceState_.wait_for_state <sdk>/core/events_.toit:18:3
  6: TcpSocket_.ensure_state_  <sdk>/net/modules/tcp.toit:67:26
  7: TcpSocket.read            <sdk>/net/modules/tcp.toit:156:16
  8: BufferedReader.more_      <sdk>/reader.toit:82:22
  9: BufferedReader.ensure_    <sdk>/reader.toit:69:14
 10: BufferedReader.ensure     <sdk>/reader.toit:102:5
 11: BufferedReader.byte       <sdk>/reader.toit:179:5
 12: Session.extract_first_message_ <sdk>/tls/session.toit:456:17
...
 27: RequestOutgoing.send      <pkg:pkg-http>/request.toit:48:32
 28: Client.post_.<block>.<block> <pkg:pkg-http>/client.toit:463:28
 29: Client.try_to_reuse_.<block> <pkg:pkg-http>/client.toit:642:7
 30: catch.<block>             <sdk>/core/exceptions.toit:124:10
 31: catch                     <sdk>/core/exceptions.toit:122:1
 32: catch                     <sdk>/core/exceptions.toit:85:10
 33: Client.try_to_reuse_      <pkg:pkg-http>/client.toit:641:5
 34: Client.post_.<block>      <pkg:pkg-http>/client.toit:460:7
 35: SmallInteger_.repeat      <sdk>/core/numbers.toit:1194:3
 36: Client.post_              <pkg:pkg-http>/client.toit:458:19
 37: Client.post_json          <pkg:pkg-http>/client.toit:523:12

After that the program never recovered. From then on, a request always yielded the following error:

******************************************************************************
EXCEPTION error. 
Mbedtls high level error 0x7700 - see https://gist.github.com/erikcorry/b25bdcacf3e0086f8a2afb688420678e
  0: tls_error_                <sdk>/tls/session.toit:741:3
  1: Session.handshake_        <sdk>/tls/session.toit:267:9
  2: Session.handshake.<block> <sdk>/tls/session.toit:211:7
  3: Session.handshake         <sdk>/tls/session.toit:172:3
  4: Session.ensure_handshaken_ <sdk>/tls/session.toit:362:5
  5: Session.write             <sdk>/tls/session.toit:298:5
  6: Socket.write              <sdk>/tls/socket.toit:97:21
  7: Writer.write              <sdk>/writer.toit:39:23
  8: Connection.send_headers   <pkg:pkg-http>/connection.toit:119:13
  9: RequestOutgoing.send      <pkg:pkg-http>/request.toit:48:32
 10: Client.post_.<block>.<block> <pkg:pkg-http>/client.toit:463:28
 11: Client.try_to_reuse_.<block> <pkg:pkg-http>/client.toit:642:7
 12: catch.<block>             <sdk>/core/exceptions.toit:124:10
 13: catch                     <sdk>/core/exceptions.toit:122:1
 14: catch                     <sdk>/core/exceptions.toit:85:10
 15: Client.try_to_reuse_      <pkg:pkg-http>/client.toit:641:5
 16: Client.post_.<block>      <pkg:pkg-http>/client.toit:460:7
 17: SmallInteger_.repeat      <sdk>/core/numbers.toit:1194:3
 18: Client.post_              <pkg:pkg-http>/client.toit:458:19
 19: Client.post_json          <pkg:pkg-http>/client.toit:523:12
...
******************************************************************************
@kasperl
Copy link
Member

kasperl commented Apr 20, 2023

This smells like we forget to close the client on the DEADLINE_EXCEEDED error, @erikcorry.

@kasperl
Copy link
Member

kasperl commented Apr 20, 2023

It looks like we get the timeout as part of a TLS handshake that is part of sending the first headers. Then we do not close the connection and try to redo the handshake on next request.

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

No branches or pull requests

2 participants