#1765 TclSockMinimumBuffers needs plat imp

obsolete: 8.5.11
closed-fixed
5
2012-04-04
2002-01-29
No

setsockopt() on windows takes a SOCKET type, not an
int which isn't the same size on Win64. I don't have
a patch ready, but noticed it while fixing porting
issues.

TclSockMinimumBuffers() is found in generic/tclIOSock.c

Discussion

  • Don Porter

    Don Porter - 2003-11-13
    • milestone: --> 155785
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2007-02-09
    • milestone: 155785 --> 652785
     
  • Donal K. Fellows

    • priority: 5 --> 7
     
  • Stuart Cassoff

    Stuart Cassoff - 2009-04-14
    • assigned_to: stwo --> davygrvy
     
  • David Gravereaux

    IMHO, this function was over-factored into generic originally.

     
  • Jan Nijtmans

    Jan Nijtmans - 2012-03-29
    • assigned_to: davygrvy --> nijtmans
    • milestone: 652785 --> obsolete: 8.5.11
     
  • Jan Nijtmans

    Jan Nijtmans - 2012-03-29

    proposal for solution committed to branch bug-510001

    For Tcl8.4 and 8.5 it effectively means removing the
    stub entry for TclSockMinimumBuffers on WIN64
    (On win32 everything stays as is). Extension writers
    using this function (are there any?) will notice that
    the function is gone. Tcl uses a small static
    function with the correct signature in stead,
    which does the right thing.

    In Tcl 8.6, it is already solved by changing the
    signature having ClientData as first parameter.

    This way, everything is kept binary compatible.
    Extension writers who want this function will
    have to use their own, or wait for Tcl 8.6.

     
  • Jan Nijtmans

    Jan Nijtmans - 2012-03-29
    • status: open --> open-fixed
     
  • Don Porter

    Don Porter - 2012-04-04

    current 8.4 branch hangs in the test suite at test
    event-11.5 . gdb points the blame at a routine:

    Program received signal SIGINT, Interrupt.
    TclSockMinimumBuffersOld (sock=0, size=0)
    at /home/dgp/fossil/tcl8.4/unix/../generic/tclStubInit.c:65

    And that leads me to report it here.

     
  • Don Porter

    Don Porter - 2012-04-04
    • priority: 7 --> 9
     
  • Don Porter

    Don Porter - 2012-04-04

    8.5 branch experiences a similar hang
    in test chan-16.9

     
  • Donal K. Fellows

    • priority: 9 --> 7
     
  • Donal K. Fellows

    Problem also experienced on OSX. Call graph is:

    Sampling process 47709 for 3 seconds with 1 millisecond of run time between samples
    Sampling completed, processing symbols...
    Analysis of sampling tcltest (pid 47709) every 1 millisecond
    Call graph:
    2508 Thread_2507
    2508 start
    2508 main
    2508 Tcl_Main
    2508 Tcl_FSEvalFile
    2508 Tcl_EvalEx
    2508 TclEvalObjvInternal
    2508 TclObjInterpProc
    2508 TclCompEvalObj
    2508 TclExecuteByteCode
    2508 TclEvalObjvInternal
    2508 Tcl_UplevelObjCmd
    2508 Tcl_EvalObjEx
    2508 Tcl_EvalObjv
    2508 TclEvalObjvInternal
    2508 TclObjInterpProc
    2508 TclCompEvalObj
    2508 TclExecuteByteCode
    2508 TclEvalObjvInternal
    2508 Tcl_UplevelObjCmd
    2508 Tcl_EvalObjEx
    2508 Tcl_EvalObjv
    2508 TclEvalObjvInternal
    2508 TclObjInterpProc
    2508 TclCompEvalObj
    2508 TclExecuteByteCode
    2508 TclEvalObjvInternal
    2508 Tcl_UplevelObjCmd
    2508 Tcl_EvalObjEx
    2508 Tcl_EvalEx
    2508 TclEvalObjvInternal
    2508 Tcl_CatchObjCmd
    2508 Tcl_EvalObjEx
    2508 TclCompEvalObj
    2508 TclExecuteByteCode
    2508 TclEvalObjvInternal
    2508 Tcl_SocketObjCmd
    2508 Tcl_OpenTcpServer
    2508 CreateSocket
    2508 TclSockMinimumBuffersOld
    2508 TclSockMinimumBuffersOld
    2508 Thread_2603
    2508 thread_start
    2508 _pthread_start
    2508 select$DARWIN_EXTSN
    2508 select$DARWIN_EXTSN

    Total number in stack (recursive counted multiple, when >=5):
    8 TclEvalObjvInternal

    Sort by top of stack, same collapsed (when >= 5):
    TclSockMinimumBuffersOld 2508
    select$DARWIN_EXTSN 2508
    Sample analysis of process 47709 written to file /dev/stdout

     
  • Donal K. Fellows

    • priority: 7 --> 9
     
  • Donal K. Fellows

    I *suspect* you've managed to make the code be defined to just call itself.

    Bumping prio to 9 as this now hangs the test suite on multiple maintenance branches.

     
  • Don Porter

    Don Porter - 2012-04-04

    #if !defined(_WIN64)
    /* See bug 510001: TclSockMinimumBuffers needs plat imp */
    # undef TclSockMinimumBuffers
    # define TclSockMinimumBuffers(a,b) TclSockMinimumBuffersOld((int)(a),b)
    #endif

     
  • Don Porter

    Don Porter - 2012-04-04

    That's at the bottom of tclIntDecls.h.

    So on any system that's not WIN64, we've
    got TCMBO endlessly calling itself recursively.

     
  • Don Porter

    Don Porter - 2012-04-04

    workaround committed. Solves the problem, but
    I don't know that it's the right fix.

     
  • Jan Nijtmans

    Jan Nijtmans - 2012-04-04
    • priority: 9 --> 5
    • status: open-fixed --> closed-fixed
     
  • Jan Nijtmans

    Jan Nijtmans - 2012-04-04

    Yes, that's the right fix. Thanks!

     
  • Jan Nijtmans

    Jan Nijtmans - 2012-04-04

    Moved the #undef up in the file, placing it together
    other #undef's which handle macros conflicting with
    later definitions in that file as well.

    All should be OK now.

     
  • David Gravereaux

    WOW. A 10 year old suggestion :) You guys rock. I've out of the scene for ages, but just recently started on a new extension to get my feet back in coding again. Long live Tcl.