Skip to content
Tcl Source Code History Of Ticket b5a02c53908e44ca
Login

History Of Ticket b5a02c53908e44ca

Artifacts Associated With Ticket b5a02c53908e44ca

  1. Ticket change [095147adea] (rid 228679) by oehhar on 2024-07-16 14:36:39:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      I get the following error trace with TWAPI 4.7.1 enabled TLS for the http package:
      
      <verbatim>
      --ErrorStack--
      can't read "state(sock)": no such variable
          while executing
      "eof $state(sock)"
          (procedure "http::Connect" line 7)
          invoked from within
      "http::Connect ::http::1 https {} /api/v2/devices/lookup.xml?di=EFRI310227552"
      --Traceback--
      INNER:loadArray1
      CALL:http::Connect ::http::1 https {} /api/v2/devices/lookup.xml?di=EFRI310227552
      CALL:::twapi::tls::_post_write_event_callback rc0
      </verbatim>
      
      The TWAPI _post_write_event_callback has the following code:
      
      <verbatim>
      # NOTE: we do not check state here as we should generate an event
      # even in the CLOSED state - see Bug #206
      chan postevent $chan write
      </verbatim>
      
      The http Connect function is as follows:
      
      <verbatim>
      proc http::Connect {token proto phost srvurl} {
          variable $token
          upvar 0 $token state
          set tk [namespace tail $token]
          set err "due to unexpected EOF"
          if {
      	[eof $state(sock)] ||
      	[set err [fconfigure $state(sock) -error]] ne ""
          } {
      </verbatim>
      
      I suppose, that http is called by TWAPI after a http cleanup.
      
      I think, it would be wise to check for $token existence at the beginning of Connect and just do nothing, if it does not exist.
      
      So, insert a line like:
      
      <verbatim>
      if {![info exists state(sock)] } {return}
      </verbatim>
      
      Does this feel like a good idea?
      
      Thank you and take care,
      Harald
      
    5. foundin initialized to: "core-8-6-branch"
    6. is_private initialized to: "0"
    7. login: "oehhar"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "oehhar"
    14. subsystem initialized to: "29. http Package"
    15. title initialized to: "Guard http::Connect against cleared socket info"
    16. type initialized to: "Bug"
  2. Ticket change [1dbc075a39] (rid 228680) by oehhar on 2024-07-16 14:52:40:

    1. comment changed to:
      I get the following error trace with TWAPI 4.7.1 enabled TLS for the http package when I cancel (::http::cleanup) the request after the start:
      
      <verbatim>
      --ErrorStack--
      can't read "state(sock)": no such variable
          while executing
      "eof $state(sock)"
          (procedure "http::Connect" line 7)
          invoked from within
      "http::Connect ::http::1 https {} /api/v2/devices/lookup.xml?di=EFRI310227552"
      --Traceback--
      INNER:loadArray1
      CALL:http::Connect ::http::1 https {} /api/v2/devices/lookup.xml?di=EFRI310227552
      CALL:::twapi::tls::_post_write_event_callback rc0
      </verbatim>
      
      http package trace:
      <verbatim>
      ^A3 URL https://accessgudid.nlm.nih.gov/api/v2/devices/lookup.xml?di=EFRI310227552 - token ::http::3
      Using rc2 for accessgudid.nlm.nih.gov:443 - token ::http::3
      </verbatim>
      
      TWAPI setup:
      <verbatim>
      http::register https 443 [concat {::twapi::tls_socket} -verifier TWAPIVerifier]
      proc TWAPIVerifier {args} { return 1 }
      </verbatim>
      
      HTTP Call:
      <verbatim>
      set URL {https://accessgudid.nlm.nih.gov/api/v2/devices/lookup.xml?di=EFRI310227552}
      set hReq [http::geturl $URL -timeout 60000 -command QueryContCall]
      ... some other commands ...
      ::http::cleanup $hReq
      </verbatim>
      
      The TWAPI _post_write_event_callback has the following code:
      
      <verbatim>
      # NOTE: we do not check state here as we should generate an event
      # even in the CLOSED state - see Bug #206
      chan postevent $chan write
      </verbatim>
      
      The http Connect function is as follows:
      
      <verbatim>
      proc http::Connect {token proto phost srvurl} {
          variable $token
          upvar 0 $token state
          set tk [namespace tail $token]
          set err "due to unexpected EOF"
          if {
      	[eof $state(sock)] ||
      	[set err [fconfigure $state(sock) -error]] ne ""
          } {
      </verbatim>
      
      I suppose, that http is called by TWAPI after a http cleanup.
      
      I think, it would be wise to check for $token existence at the beginning of Connect and just do nothing, if it does not exist.
      
      So, insert a line like:
      
      <verbatim>
      if {![info exists state(sock)] } {return}
      </verbatim>
      
      Does this feel like a good idea?
      
      Thank you and take care,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/plain"