toitlang / toitlang/pkg-http

Connection enters bad state

Open
#92 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Toit
Stars
3
Forks
2
Avg merge
53m
Merged PRs (30d)
1

Description

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
...
******************************************************************************

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pkg-http/client.toit around Client.try_to_reuse_ and post_, then follow the reported path through connection.toit and request.toit into the SDK TLS and TCP files named in the traces. Reproduce the DEADLINE_EXCEEDED case and determine whether subsequent requests can recover instead of repeatedly producing the MbedTLS error.

Written by the indexing model from the issue text.

Assessment

Domain
api, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.