Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2012-04-05
10:39 • Ticket [510001ffff] TclSockMinimumBuffers needs plat imp status still Closed... artifact: a5c235c6e5 user: davygrvy
05:45 • Ticket [510001ffff]: 4 changes artifact: 80af33f4d5 user: nijtmans
2012-04-04
21:58 • Closed ticket [510001ffff]. artifact: fea44d3aa4 user: nijtmans
21:45 • Ticket [510001ffff]: 4 changes artifact: 58b554a334 user: dgp
21:41 • Ticket [510001ffff]: 4 changes artifact: 58fbf39a10 user: dgp
21:40 • Ticket [510001ffff]: 4 changes artifact: bd5fb008da user: dgp
21:34 • Ticket [510001ffff]: 5 changes artifact: 5ab07138ed user: dkf
21:31 • Ticket [510001ffff]: 5 changes artifact: 593fee9242 user: dkf
21:30 • Ticket [510001ffff]: 4 changes artifact: 3662366904 user: dgp
21:29 • Ticket [510001ffff]: 5 changes artifact: 3cc7bf7402 user: dgp
2012-03-29
17:26 • Ticket [510001ffff]: 1 change artifact: 4ee6909647 user: nijtmans
17:26 • Ticket [510001ffff]: 4 changes artifact: 3494fab776 user: nijtmans
16:52 • Ticket [510001ffff]: 2 changes artifact: 5b7eeaae15 user: nijtmans
2009-04-15
04:45 • Ticket [510001ffff]: 4 changes artifact: e278406068 user: davygrvy
03:54 • Ticket [510001ffff]: 1 change artifact: 6a63dc296c user: stwo
2007-02-12
00:40 • Ticket [510001ffff]: 1 change artifact: 250c27e4df user: dkf
2007-02-10
01:47 • Ticket [510001ffff]: 1 change artifact: 12ecdae4bf user: hobbs
2003-11-13
08:43 • Ticket [510001ffff]: 1 change artifact: d1df5fa239 user: dgp
2002-01-29
02:48 • New ticket [510001ffff]. artifact: ec17f42c39 user: davygrvy

TclSockMinimumBuffers needs plat imp

Closed / Fixed510001ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 15 years ago
Descriptionplain2002-01-29 02:48:32
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
dgp Ticket [510001ffff]: 1 change [History diff]2003-11-13 08:43:40
hobbs Ticket [510001ffff]: 1 change [History diff]2007-02-10 01:47:06
dkf Ticket [510001ffff]: 1 change [History diff]2007-02-12 00:40:03
stwo Ticket [510001ffff]: 1 change [History diff]2009-04-15 03:54:06
davygrvyplain2009-04-15 04:45:18
IMHO, this function was over-factored into generic originally.
nijtmans Ticket [510001ffff]: 2 changes [History diff]2012-03-29 16:52:06
nijtmansplain2012-03-29 17:26:23
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.
nijtmans Ticket [510001ffff]: 1 change [History diff]2012-03-29 17:26:33
dgpplain2012-04-04 21:29:24
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.
dgpplain2012-04-04 21:30:09
8.5 branch experiences a similar hang
in test chan-16.9
dkfplain2012-04-04 21:31:55
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
dkfplain2012-04-04 21:34:29
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.
dgpplain2012-04-04 21:40:18
#if !defined(_WIN64)
/* See bug 510001: TclSockMinimumBuffers needs plat imp */
#   undef TclSockMinimumBuffers
#   define TclSockMinimumBuffers(a,b) TclSockMinimumBuffersOld((int)(a),b)
#endif
dgpplain2012-04-04 21:41:29
That's at the bottom of tclIntDecls.h.

So on any system that's not WIN64, we've
got TCMBO endlessly calling itself recursively.
dgpplain2012-04-04 21:45:31
workaround committed.  Solves the problem, but
I don't know that it's the right fix.
nijtmansplain2012-04-04 21:58:37
Yes, that's the right fix. Thanks!
nijtmansplain2012-04-05 05:45:07
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.
davygrvyplain2012-04-05 10:39:58
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.
Log in (anonymous is fine) to add a comment.